diff --git a/image/src/github_pr_comment/__main__.py b/image/src/github_pr_comment/__main__.py index 3ab8e60a..92d562cd 100644 --- a/image/src/github_pr_comment/__main__.py +++ b/image/src/github_pr_comment/__main__.py @@ -511,7 +511,7 @@ def main() -> int: changes = os.environ.get('TF_CHANGES') == 'true' highlighting = '' - if 'Plan:' in body: + if os.environ.get('TF_CHANGES', 'true') == 'true': highlighting = 'diff' if format_type.startswith('diff') else 'hcl' comment = update_comment( diff --git a/image/src/github_pr_comment/plan_formatting.py b/image/src/github_pr_comment/plan_formatting.py index 3dfc46a6..8f5eac7e 100644 --- a/image/src/github_pr_comment/plan_formatting.py +++ b/image/src/github_pr_comment/plan_formatting.py @@ -15,8 +15,6 @@ def format_diff(plan_text: str) -> str: continue elif line.endswith('EOT'): heredoc = True - lines.append(line) - continue replaced = (re.sub( r'^(?P\s+)(?P[+-/~]+)(?P.*)', diff --git a/tests/test_diff_formatting.py b/tests/test_diff_formatting.py index 23ddf289..510fc2bb 100644 --- a/tests/test_diff_formatting.py +++ b/tests/test_diff_formatting.py @@ -236,7 +236,7 @@ def test_heredoc(): # random_string.add will be created + resource "random_string" "add" { - + id = <