Skip to content

Commit 7201d8c

Browse files
authored
Merge pull request #345 from dflook/hide-outdated
Hide outdated comments
2 parents 9c15d46 + feb3f4e commit 7201d8c

File tree

8 files changed

+195
-91
lines changed

8 files changed

+195
-91
lines changed

.github/workflows/test-plan.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -863,20 +863,20 @@ jobs:
863863
path: tests/workflows/test-plan/plan
864864
label: test-plan test_plan_1_4
865865

866-
arm64:
867-
runs-on: buildjet-2vcpu-ubuntu-2204-arm
868-
name: Test on arm64
869-
env:
870-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
871-
steps:
872-
- name: Checkout
873-
uses: actions/checkout@v4
874-
875-
- name: Plan
876-
uses: ./terraform-plan
877-
with:
878-
path: tests/workflows/test-plan/plan
879-
label: arm64
866+
# arm64:
867+
# runs-on: buildjet-2vcpu-ubuntu-2204-arm
868+
# name: Test on arm64
869+
# env:
870+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
871+
# steps:
872+
# - name: Checkout
873+
# uses: actions/checkout@v4
874+
#
875+
# - name: Plan
876+
# uses: ./terraform-plan
877+
# with:
878+
# path: tests/workflows/test-plan/plan
879+
# label: arm64
880880

881881
always_new:
882882
runs-on: ubuntu-latest

.github/workflows/test-version.yaml

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ jobs:
526526

527527
- name: Check the version
528528
run: |
529-
if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.8"* ]]; then
529+
if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.9"* ]]; then
530530
echo "::error:: Latest version was not used"
531531
exit 1
532532
fi
@@ -627,55 +627,55 @@ jobs:
627627
exit 1
628628
fi
629629
630-
arm64:
631-
runs-on: buildjet-2vcpu-ubuntu-2204-arm
632-
name: Version detection on arm
633-
steps:
634-
- name: Checkout
635-
uses: actions/checkout@v4
636-
637-
- name: Version unsupported on arm
638-
uses: ./terraform-version
639-
continue-on-error: true
640-
id: arm-unsupported
641-
env:
642-
TERRAFORM_VERSION: 0.12.0
643-
with:
644-
path: tests/workflows/test-version/empty
645-
646-
- name: Check failed to download unsupported platform
647-
run: |
648-
if [[ "${{ steps.arm-unsupported.outcome }}" != "failure" ]]; then
649-
echo "Did not fail correctly"
650-
exit 1
651-
fi
652-
653-
- name: Version doesn't exist
654-
uses: ./terraform-version
655-
continue-on-error: true
656-
id: no-such-version
657-
with:
658-
path: tests/workflows/test-version/nosuchversion
659-
660-
- name: Check failed to download no such version
661-
run: |
662-
if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then
663-
echo "Did not fail correctly"
664-
exit 1
665-
fi
666-
667-
- name: Test terraform-version
668-
uses: ./terraform-version
669-
id: terraform-version
670-
with:
671-
path: tests/workflows/test-version/tfswitch
672-
673-
- name: Check the version
674-
run: |
675-
if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then
676-
echo "::error:: Terraform version not set from .tfswitchrc"
677-
exit 1
678-
fi
630+
# arm64:
631+
# runs-on: buildjet-2vcpu-ubuntu-2204-arm
632+
# name: Version detection on arm
633+
# steps:
634+
# - name: Checkout
635+
# uses: actions/checkout@v4
636+
#
637+
# - name: Version unsupported on arm
638+
# uses: ./terraform-version
639+
# continue-on-error: true
640+
# id: arm-unsupported
641+
# env:
642+
# TERRAFORM_VERSION: 0.12.0
643+
# with:
644+
# path: tests/workflows/test-version/empty
645+
#
646+
# - name: Check failed to download unsupported platform
647+
# run: |
648+
# if [[ "${{ steps.arm-unsupported.outcome }}" != "failure" ]]; then
649+
# echo "Did not fail correctly"
650+
# exit 1
651+
# fi
652+
#
653+
# - name: Version doesn't exist
654+
# uses: ./terraform-version
655+
# continue-on-error: true
656+
# id: no-such-version
657+
# with:
658+
# path: tests/workflows/test-version/nosuchversion
659+
#
660+
# - name: Check failed to download no such version
661+
# run: |
662+
# if [[ "${{ steps.no-such-version.outcome }}" != "failure" ]]; then
663+
# echo "Did not fail correctly"
664+
# exit 1
665+
# fi
666+
#
667+
# - name: Test terraform-version
668+
# uses: ./terraform-version
669+
# id: terraform-version
670+
# with:
671+
# path: tests/workflows/test-version/tfswitch
672+
#
673+
# - name: Check the version
674+
# run: |
675+
# if [[ "${{ steps.terraform-version.outputs.terraform }}" != "1.1.0" ]]; then
676+
# echo "::error:: Terraform version not set from .tfswitchrc"
677+
# exit 1
678+
# fi
679679

680680
terraform_opentofu_version:
681681
runs-on: ubuntu-latest
@@ -740,6 +740,8 @@ jobs:
740740
opentofu_version_pre_release_nosig:
741741
runs-on: ubuntu-latest
742742
name: OPENTOFU_VERSION pre-release with tofu action
743+
env:
744+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
743745
steps:
744746
- name: Checkout
745747
uses: actions/checkout@v4
@@ -770,6 +772,8 @@ jobs:
770772
opentofu_old_version:
771773
runs-on: ubuntu-latest
772774
name: Prefer OpenTofu, but only Terraform matches constraints
775+
env:
776+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
773777
steps:
774778
- name: Checkout
775779
uses: actions/checkout@v4

.github/workflows/test.yaml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,30 @@ jobs:
3232
run: |
3333
GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests
3434
35-
pytest_arm64:
36-
runs-on: buildjet-2vcpu-ubuntu-2204-arm
37-
name: pytest arm64
38-
needs: pytest_amd64
39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@v4
42-
43-
- name: Install dependencies
44-
run: |
45-
python -m pip install --upgrade pip
46-
pip install -r tests/requirements.txt
47-
48-
gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F \
49-
&& echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust
50-
51-
- name: Run tests
52-
env:
53-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
54-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55-
TERRAFORM_ACTIONS_GITHUB_TOKEN: No
56-
run: |
57-
GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests
35+
# buildjet doesn't start the job most of the time
36+
# pytest_arm64:
37+
# runs-on: buildjet-2vcpu-ubuntu-2204-arm
38+
# name: pytest arm64
39+
# needs: pytest_amd64
40+
# steps:
41+
# - name: Checkout
42+
# uses: actions/checkout@v4
43+
#
44+
# - name: Install dependencies
45+
# run: |
46+
# python -m pip install --upgrade pip
47+
# pip install -r tests/requirements.txt
48+
#
49+
# gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F \
50+
# && echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust
51+
#
52+
# - name: Run tests
53+
# env:
54+
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
55+
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
56+
# TERRAFORM_ACTIONS_GITHUB_TOKEN: No
57+
# run: |
58+
# GNUPGHOME=$HOME/.gnupg PYTHONPATH=image/tools:image/src pytest tests
5859

5960
tofu:
6061
runs-on: ubuntu-latest

image/src/github_actions/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
IssueUrl = NewType('IssueUrl', GitHubUrl)
1414
CommentUrl = NewType('CommentUrl', GitHubUrl)
1515
CommentReactionUrl = NewType('CommentReactionUrl', GitHubUrl)
16+
NodeId = NewType('NodeId', str)
1617

1718

1819
class GithubApi:

image/src/github_pr_comment/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from github_pr_comment.backend_config import complete_config, partial_config
2020
from github_pr_comment.backend_fingerprint import fingerprint
2121
from github_pr_comment.cmp import plan_cmp, remove_warnings, remove_unchanged_attributes
22-
from github_pr_comment.comment import find_comment, TerraformComment, update_comment, serialize, deserialize
22+
from github_pr_comment.comment import find_comment, TerraformComment, update_comment, serialize, deserialize, hide_comment
2323
from github_pr_comment.hash import comment_hash, plan_hash, plan_out_hash
2424
from github_pr_comment.plan_formatting import format_diff
2525
from plan_renderer.outputs import render_outputs
@@ -323,6 +323,7 @@ def new_pr_comment(backend_fingerprint: bytes) -> TerraformComment:
323323
return TerraformComment(
324324
issue_url=issue_url,
325325
comment_url=None,
326+
node_id=None,
326327
headers={k: v for k, v in headers.items() if v is not None},
327328
description='',
328329
summary='',
@@ -497,6 +498,11 @@ def main() -> int:
497498
headers=comment.headers | {'closed': True},
498499
status=':spider_web: Plan is outdated'
499500
)
501+
hide_comment(
502+
github,
503+
comment,
504+
'OUTDATED'
505+
)
500506

501507
# Create the replacement comment
502508
comment = new_pr_comment(backend_fingerprint)

0 commit comments

Comments
 (0)