Skip to content

Commit

Permalink
Change review apps PR workflow to leave only one comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lfdebrux committed Feb 26, 2025
1 parent c703095 commit 7d90641
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,10 +76,12 @@ 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"
$COMMENT_MARKER
:tada: A review copy of this PR has been deployed! You can reach it at ${{steps.deploy.outputs.REVIEW_APP_URL}}.
It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
Expand All @@ -89,4 +91,9 @@ jobs:
For more details please see the [review app wiki page](https://github.com/alphagov/forms-team/wiki/Review-apps)
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 | startswith($ENV.COMMENT_MARKER)))) | .[].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 7d90641

Please sign in to comment.