Skip to content

Commit

Permalink
Merge pull request #1804 from alphagov/ldeb-change-review-apps-commen…
Browse files Browse the repository at this point in the history
…t-delete-old-comments

Change review apps PR workflow to leave only one comment
  • Loading branch information
lfdebrux authored Feb 27, 2025
2 parents 93143dc + 6a39b7b commit 64886e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/review_apps_on_pr_change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ jobs:
- name: Comment on PR
env:
COMMENT_MARKER: <!-- review apps on pr change -->
GH_TOKEN: ${{ github.token }}
run: |
cat <<EOF > "${{runner.temp}}/pr-comment.md"
:tada: A review copy of this PR has been deployed! You can reach it at ${{steps.deploy.outputs.REVIEW_APP_URL}}.
Expand All @@ -87,6 +87,13 @@ jobs:
to debug, or otherwise ask an infrastructure person.
For more details please see the [review app wiki page](https://github.com/alphagov/forms-team/wiki/Review-apps)
$COMMENT_MARKER
EOF
old_comment_ids=$(gh api "repos/{owner}/{repo}/issues/${{github.event.pull_request.number}}/comments" --jq 'map(select((.user.login == "github-actions[bot]") and (.body | endswith($ENV.COMMENT_MARKER + "\n")))) | .[].id')
for comment_id in $old_comment_ids; do
gh api -X DELETE "repos/{owner}/{repo}/issues/comments/${comment_id}"
done
gh pr comment "${{github.event.pull_request.html_url}}" --body-file "${{runner.temp}}/pr-comment.md"

0 comments on commit 64886e2

Please sign in to comment.