Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only highlight Terraform changes on GitHub #2337

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

pauloconnor
Copy link
Contributor

The lazy regex for converting Terraform diffs to GitHub diffs would also mark YAML and other plain text that happen to start with -, +, or ~. This is a bit more selective, scanning for obvious Terraform changes that contain ->, << for heredocs, { for modules/resources/blocks, known after apply, and [ for lists. It will also do a second pass to attempt to capture changes to lists too.

Closes #2241

@pauloconnor pauloconnor requested a review from a team as a code owner June 24, 2022 22:21
@pauloconnor pauloconnor changed the title feat: Only highlight Terraform changes on GitHub fix: Only highlight Terraform changes on GitHub Jun 24, 2022
@pauloconnor pauloconnor force-pushed the github_markdown_yaml branch from a3bf2dc to d506fb3 Compare June 24, 2022 22:30
Copy link
Contributor

@dupuy26 dupuy26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks! The tests and regexes look correct to me. It might be worth adding a test with embedded <<EOT YAML content with list items, to ensure that future changes don't break things (e.g. by removing the trailing comma for the list check).

I'd approve this anyhow, except that I think my approval won't count for anything.

@pauloconnor
Copy link
Contributor Author

Adding a test with embedded <<EOT YAML content with list items, to ensure that future changes don't break things (e.g. by removing the trailing comma for the list check).

Do you have a sample of what mean? I don't quite follow

@dupuy26
Copy link
Contributor

dupuy26 commented Jun 29, 2022

Do you have a sample of what mean? I don't quite follow

Looking at line 2203 of markdown_renderer_test.go I think you already have this covered (there's also a base64 block example). I think it is absolutely fine to go.

@jamengual
Copy link
Contributor

@pauloconnor Thanks for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub Markdown syntax is not respecting YAML output - specifically lists
4 participants