diff --git a/.github/workflows/test-plan.yaml b/.github/workflows/test-plan.yaml index 49eff598..a50de6ef 100644 --- a/.github/workflows/test-plan.yaml +++ b/.github/workflows/test-plan.yaml @@ -863,20 +863,20 @@ jobs: path: tests/workflows/test-plan/plan label: test-plan test_plan_1_4 - arm64: - runs-on: buildjet-2vcpu-ubuntu-2204-arm - name: Test on arm64 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Plan - uses: ./terraform-plan - with: - path: tests/workflows/test-plan/plan - label: arm64 +# arm64: +# runs-on: buildjet-2vcpu-ubuntu-2204-arm +# name: Test on arm64 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# +# - name: Plan +# uses: ./terraform-plan +# with: +# path: tests/workflows/test-plan/plan +# label: arm64 always_new: runs-on: ubuntu-latest diff --git a/.github/workflows/test-version.yaml b/.github/workflows/test-version.yaml index 1775c5d6..108b6764 100644 --- a/.github/workflows/test-version.yaml +++ b/.github/workflows/test-version.yaml @@ -526,7 +526,7 @@ jobs: - name: Check the version run: | - if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.8"* ]]; then + if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.9"* ]]; then echo "::error:: Latest version was not used" exit 1 fi @@ -627,55 +627,55 @@ jobs: exit 1 fi - arm64: - runs-on: buildjet-2vcpu-ubuntu-2204-arm - name: Version detection on arm - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Version unsupported on arm - uses: ./terraform-version - continue-on-error: true - id: arm-unsupported - env: - TERRAFORM_VERSION: 0.12.0 - with: - path: tests/workflows/test-version/empty - - - name: Check failed to download unsupported platform - run: | - if [[ "${{ steps.arm-unsupported.outcome }}" != "failure" ]]; then - echo "Did not fail correctly" - exit 1 - fi - - - name: Version doesn't exist - uses: ./terraform-version - continue-on-error: true - id: no-such-version - with: - path: tests/workflows/test-version/nosuchversion - - - name: Check failed to download no such version - run: | - if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then - echo "Did not fail correctly" - exit 1 - fi - - - name: Test terraform-version - uses: ./terraform-version - id: terraform-version - with: - path: tests/workflows/test-version/tfswitch - - - name: Check the version - run: | - if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then - echo "::error:: Terraform version not set from .tfswitchrc" - exit 1 - fi +# arm64: +# runs-on: buildjet-2vcpu-ubuntu-2204-arm +# name: Version detection on arm +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# +# - name: Version unsupported on arm +# uses: ./terraform-version +# continue-on-error: true +# id: arm-unsupported +# env: +# TERRAFORM_VERSION: 0.12.0 +# with: +# path: tests/workflows/test-version/empty +# +# - name: Check failed to download unsupported platform +# run: | +# if [[ "${{ steps.arm-unsupported.outcome }}" != "failure" ]]; then +# echo "Did not fail correctly" +# exit 1 +# fi +# +# - name: Version doesn't exist +# uses: ./terraform-version +# continue-on-error: true +# id: no-such-version +# with: +# path: tests/workflows/test-version/nosuchversion +# +# - name: Check failed to download no such version +# run: | +# if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then +# echo "Did not fail correctly" +# exit 1 +# fi +# +# - name: Test terraform-version +# uses: ./terraform-version +# id: terraform-version +# with: +# path: tests/workflows/test-version/tfswitch +# +# - name: Check the version +# run: | +# if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then +# echo "::error:: Terraform version not set from .tfswitchrc" +# exit 1 +# fi terraform_opentofu_version: runs-on: ubuntu-latest @@ -740,6 +740,8 @@ jobs: opentofu_version_pre_release_nosig: runs-on: ubuntu-latest name: OPENTOFU_VERSION pre-release with tofu action + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v4 @@ -770,6 +772,8 @@ jobs: opentofu_old_version: runs-on: ubuntu-latest name: Prefer OpenTofu, but only Terraform matches constraints + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd19a763..f0cd5d73 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,29 +32,30 @@ jobs: run: | GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests - pytest_arm64: - runs-on: buildjet-2vcpu-ubuntu-2204-arm - name: pytest arm64 - needs: pytest_amd64 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r tests/requirements.txt - - gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F \ - && echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust - - - name: Run tests - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - TERRAFORM_ACTIONS_GITHUB_TOKEN: No - run: | - GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests +# buildjet doesn't start the job most of the time +# pytest_arm64: +# runs-on: buildjet-2vcpu-ubuntu-2204-arm +# name: pytest arm64 +# needs: pytest_amd64 +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -r tests/requirements.txt +# +# gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F \ +# && echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust +# +# - name: Run tests +# env: +# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} +# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +# TERRAFORM_ACTIONS_GITHUB_TOKEN: No +# run: | +# GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests tofu: runs-on: ubuntu-latest diff --git a/image/src/github_actions/api.py b/image/src/github_actions/api.py index 4ddb50d5..e2893635 100644 --- a/image/src/github_actions/api.py +++ b/image/src/github_actions/api.py @@ -13,6 +13,7 @@ IssueUrl = NewType('IssueUrl', GitHubUrl) CommentUrl = NewType('CommentUrl', GitHubUrl) CommentReactionUrl = NewType('CommentReactionUrl', GitHubUrl) +NodeId = NewType('NodeId', str) class GithubApi: diff --git a/image/src/github_pr_comment/__main__.py b/image/src/github_pr_comment/__main__.py index 2caccbac..db054ec0 100644 --- a/image/src/github_pr_comment/__main__.py +++ b/image/src/github_pr_comment/__main__.py @@ -19,7 +19,7 @@ from github_pr_comment.backend_config import complete_config, partial_config from github_pr_comment.backend_fingerprint import fingerprint from github_pr_comment.cmp import plan_cmp, remove_warnings, remove_unchanged_attributes -from github_pr_comment.comment import find_comment, TerraformComment, update_comment, serialize, deserialize +from github_pr_comment.comment import find_comment, TerraformComment, update_comment, serialize, deserialize, hide_comment from github_pr_comment.hash import comment_hash, plan_hash, plan_out_hash from github_pr_comment.plan_formatting import format_diff from plan_renderer.outputs import render_outputs @@ -323,6 +323,7 @@ def new_pr_comment(backend_fingerprint: bytes) -> TerraformComment: return TerraformComment( issue_url=issue_url, comment_url=None, + node_id=None, headers={k: v for k, v in headers.items() if v is not None}, description='', summary='', @@ -497,6 +498,11 @@ def main() -> int: headers=comment.headers | {'closed': True}, status=':spider_web: Plan is outdated' ) + hide_comment( + github, + comment, + 'OUTDATED' + ) # Create the replacement comment comment = new_pr_comment(backend_fingerprint) diff --git a/image/src/github_pr_comment/comment.py b/image/src/github_pr_comment/comment.py index 28cc6a9d..b58df988 100644 --- a/image/src/github_pr_comment/comment.py +++ b/image/src/github_pr_comment/comment.py @@ -4,7 +4,7 @@ from json import JSONDecodeError from typing import Optional, Any -from github_actions.api import IssueUrl, GithubApi, CommentUrl +from github_actions.api import IssueUrl, GithubApi, CommentUrl, NodeId from github_actions.debug import debug try: @@ -43,9 +43,10 @@ class TerraformComment: """ - def __init__(self, *, issue_url: IssueUrl, comment_url: Optional[CommentUrl], headers: dict[str, str], description: str, summary: str, body: str, status: str, body_highlighting: str = ''): + def __init__(self, *, issue_url: IssueUrl, comment_url: Optional[CommentUrl], node_id: Optional[NodeId], headers: dict[str, str], description: str, summary: str, body: str, status: str, body_highlighting: str = ''): self._issue_url = issue_url self._comment_url = comment_url + self._node_id = node_id self._headers = headers self._description = description.strip() self._summary = summary.strip() @@ -60,6 +61,7 @@ def __eq__(self, other): return ( self._issue_url == other._issue_url and self._comment_url == other._comment_url and + self._node_id == other._node_id and self._headers == other._headers and self._description == other._description and self._summary == other._summary and @@ -72,7 +74,7 @@ def __ne__(self, other): return not self.__eq__(other) def __repr__(self): - return f'TerraformComment(issue_url={self._issue_url!r}, comment_url={self._comment_url!r}, headers={self._headers!r}, description={self._description!r}, summary={self._summary!r}, body={self._body!r}, status={self._status!r}, body_highlighting={self._body_highlighting!r})' + return f'TerraformComment(issue_url={self._issue_url!r}, comment_url={self._comment_url!r}, node_id={self.node_id}, headers={self._headers!r}, description={self._description!r}, summary={self._summary!r}, body={self._body!r}, status={self._status!r}, body_highlighting={self._body_highlighting!r})' @property def comment_url(self) -> Optional[CommentUrl]: @@ -84,6 +86,16 @@ def comment_url(self, comment_url: CommentUrl) -> None: raise Exception('Can only set url for comments that don\'t exist yet') self._comment_url = comment_url + @property + def node_id(self) -> Optional[NodeId]: + return self._node_id + + @node_id.setter + def node_id(self, node_id: NodeId) -> None: + if self._node_id is not None: + raise Exception('Can only set node_id for comments that don\'t exist yet') + self._node_id = node_id + @property def issue_url(self) -> IssueUrl: return self._issue_url @@ -116,6 +128,7 @@ def serialize(comment: TerraformComment) -> str: return json.dumps({ 'issue_url': comment.issue_url, 'comment_url': comment.comment_url, + 'node_id': comment.node_id, 'headers': comment.headers, 'description': comment.description, 'summary': comment.summary, @@ -130,6 +143,7 @@ def deserialize(s) -> TerraformComment: return TerraformComment( issue_url=j['issue_url'], comment_url=j['comment_url'], + node_id=j.get('node_id'), headers=j['headers'], description=j['description'], summary=j['summary'], @@ -176,6 +190,7 @@ def _from_api_payload(comment: dict[str, Any]) -> Optional[TerraformComment]: return TerraformComment( issue_url=comment['issue_url'], comment_url=comment['url'], + node_id=comment.get('node_id'), headers=_parse_comment_header(match.group('headers')), description=match.group('description').strip(), summary=match.group('summary').strip(), @@ -290,6 +305,7 @@ def find_comment(github: GithubApi, issue_url: IssueUrl, username: str, headers: return TerraformComment( issue_url=backup_comment.issue_url, comment_url=backup_comment.comment_url, + node_id=backup_comment.node_id, headers=backup_comment.headers | headers, description=backup_comment.description, summary=backup_comment.summary, @@ -305,6 +321,7 @@ def find_comment(github: GithubApi, issue_url: IssueUrl, username: str, headers: return TerraformComment( issue_url=legacy_comment.issue_url, comment_url=legacy_comment.comment_url, + node_id=legacy_comment.node_id, headers={k: v for k, v in headers.items() if v is not None}, description=legacy_comment.description, summary=legacy_comment.summary, @@ -317,6 +334,7 @@ def find_comment(github: GithubApi, issue_url: IssueUrl, username: str, headers: return TerraformComment( issue_url=issue_url, comment_url=None, + node_id=None, headers={k: v for k, v in headers.items() if v is not None}, description='', summary='', @@ -344,6 +362,7 @@ def update_comment( new_comment = TerraformComment( issue_url=comment.issue_url, comment_url=comment.comment_url, + node_id=comment.node_id, headers=new_headers, description=description if description is not None else comment.description, summary=summary if summary is not None else comment.summary, @@ -355,9 +374,37 @@ def update_comment( if comment.comment_url is not None: response = github.patch(comment.comment_url, json={'body': _to_api_payload(new_comment)}) response.raise_for_status() + if comment.node_id is None: + comment.node_id = response.json().get('node_id') else: response = github.post(comment.issue_url + '/comments', json={'body': _to_api_payload(new_comment)}) response.raise_for_status() new_comment.comment_url = response.json()['url'] + new_comment.node_id = response.json().get('node_id') return new_comment + +def hide_comment( + github: GithubApi, + comment: TerraformComment, + classifier: str +) -> None: + + if comment.node_id is None: + debug('Comment has unknown node_id - not hiding') + return + + graphql_url = os.environ.get('GITHUB_GRAPHQL_URL', f'{os.environ["GITHUB_API_URL"]}/graphql') + + response = github.post( + graphql_url, json={ + 'query': ''' + mutation { + minimizeComment(input: {subjectId: "''' + comment.node_id + '''", classifier: ''' + classifier + '''}) { + clientMutationId + } + } + ''' + } + ) + debug(f'graphql response: {response.content}') diff --git a/tests/github_pr_comment/test_comment.py b/tests/github_pr_comment/test_comment.py index 61823233..fc16f282 100644 --- a/tests/github_pr_comment/test_comment.py +++ b/tests/github_pr_comment/test_comment.py @@ -1,6 +1,8 @@ import random import string +from typing import cast +from github_actions.api import NodeId from github_pr_comment.comment import _format_comment_header, _parse_comment_header, TerraformComment, _to_api_payload, _from_api_payload @@ -23,6 +25,7 @@ def test_comment_header(): def test_no_headers(): issue_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) comment_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) + node_id = cast(NodeId, ''.join(random.choice(string.ascii_letters) for _ in range(10))) status = 'Testing' description = 'Hello, this is a description' summary = 'Some changes' @@ -34,6 +37,7 @@ def test_no_headers(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status=status, headers={}, description=description, @@ -44,6 +48,7 @@ def test_no_headers(): assert _from_api_payload({ 'body': _to_api_payload(expected), 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -51,6 +56,7 @@ def test_no_headers(): def test_headers(): issue_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) comment_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) + node_id = cast(NodeId, ''.join(random.choice(string.ascii_letters) for _ in range(10))) status = 'Testing' description = 'Hello, this is a description' summary = 'Some changes' @@ -66,6 +72,7 @@ def test_headers(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status=status, headers=headers, description=description, @@ -76,6 +83,7 @@ def test_headers(): assert _from_api_payload({ 'body': _to_api_payload(expected), 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -83,6 +91,7 @@ def test_headers(): def test_bad_description(): issue_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) comment_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) + node_id = cast(NodeId, ''.join(random.choice(string.ascii_letters) for _ in range(10))) status = 'Testing' summary = 'Some changes' body = '''blah blah body''' @@ -96,6 +105,7 @@ def test_bad_description(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status=status, headers=headers, description=description, @@ -106,6 +116,7 @@ def test_bad_description(): assert _from_api_payload({ 'body': _to_api_payload(expected), 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -113,6 +124,7 @@ def test_bad_description(): def test_bad_body(): issue_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) comment_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) + node_id = cast(NodeId, ''.join(random.choice(string.ascii_letters) for _ in range(10))) status = 'Testing' summary = 'Some changes' description = '''blah blah description''' @@ -126,6 +138,7 @@ def test_bad_body(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status=status, headers=headers, description=description, @@ -136,5 +149,6 @@ def test_bad_body(): assert _from_api_payload({ 'body': _to_api_payload(expected), 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected diff --git a/tests/github_pr_comment/test_legacy_comment.py b/tests/github_pr_comment/test_legacy_comment.py index 3745ad1c..2b51fac0 100644 --- a/tests/github_pr_comment/test_legacy_comment.py +++ b/tests/github_pr_comment/test_legacy_comment.py @@ -13,6 +13,7 @@ issue_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) comment_url = ''.join(random.choice(string.ascii_letters) for _ in range(10)) +node_id = ''.join(random.choice(string.ascii_letters) for _ in range(10)) def test_path_only(): payload = '''Terraform plan in __/test/terraform__ @@ -31,6 +32,7 @@ def test_path_only(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='Terraform plan in __/test/terraform__', @@ -42,6 +44,7 @@ def test_path_only(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -63,6 +66,7 @@ def test_nondefault_workspace(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='Terraform plan in __/test/terraform__ in the __myworkspace__ workspace', @@ -74,6 +78,7 @@ def test_nondefault_workspace(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -97,6 +102,7 @@ def test_variables_single_line(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='Terraform plan in __/test/terraform__\nWith variables: `var1="value"`', @@ -108,6 +114,7 @@ def test_variables_single_line(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -136,6 +143,7 @@ def test_variables_multi_line(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__
With variables @@ -153,6 +161,7 @@ def test_variables_multi_line(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -175,6 +184,7 @@ def test_var(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -187,6 +197,7 @@ def test_var(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -209,6 +220,7 @@ def test_var_file(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -221,6 +233,7 @@ def test_var_file(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -244,6 +257,7 @@ def test_backend_config(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -256,6 +270,7 @@ def test_backend_config(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -278,6 +293,7 @@ def test_backend_config_bad_words(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -290,6 +306,7 @@ def test_backend_config_bad_words(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -311,6 +328,7 @@ def test_target(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -323,6 +341,7 @@ def test_target(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -344,6 +363,7 @@ def test_replace(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -356,6 +376,7 @@ def test_replace(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -378,6 +399,7 @@ def test_backend_config_file(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ @@ -390,6 +412,7 @@ def test_backend_config_file(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -417,6 +440,7 @@ def test_all(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan in __/test/terraform__ in the __test__ workspace @@ -434,6 +458,7 @@ def test_all(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -455,6 +480,7 @@ def test_label(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='''Terraform plan for __test_label__''', @@ -466,6 +492,7 @@ def test_label(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -489,6 +516,7 @@ def test_error(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status=':x: Failed to generate plan in [Test terraform-plan #603](https://github.com/dflook/terraform-github-actions/actions/runs/6684032578)', headers={}, description='''Terraform plan in __tests/workflows/test-plan/error__''', @@ -504,6 +532,7 @@ def test_error(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected @@ -524,6 +553,7 @@ def test_diff(): expected = TerraformComment( issue_url=issue_url, comment_url=comment_url, + node_id=node_id, status='Testing', headers={}, description='Terraform plan in __/test/terraform__ in the __myworkspace__ workspace', @@ -535,5 +565,6 @@ def test_diff(): assert _from_api_payload({ 'body': payload, 'url': comment_url, + 'node_id': node_id, 'issue_url': issue_url }) == expected