From 0372a51938b06f7803b23639ac3638de6d9961d9 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis Date: Fri, 13 Mar 2026 14:35:07 +0000 Subject: [PATCH] CLDC-4263: add descriptive comment --- .github/workflows/review_pipeline.yml | 49 +++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/workflows/review_pipeline.yml b/.github/workflows/review_pipeline.yml index da45db9b1..7d8d38392 100644 --- a/.github/workflows/review_pipeline.yml +++ b/.github/workflows/review_pipeline.yml @@ -17,6 +17,32 @@ defaults: shell: bash jobs: + hint: + name: Add review app hint + if: github.event.action == 'opened' && !contains(github.event.pull_request.labels.*.name, 'deploy-review') + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Comment on PR + uses: actions/github-script@v7 + with: + script: | + const msg = 'To deploy a review app for this PR, add the `deploy-review` label.'; + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + if (!comments.find(c => c.body.startsWith('To deploy a review app'))) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: msg, + }); + } + infra: name: Deploy review app infrastructure if: contains(github.event.pull_request.labels.*.name, 'deploy-review') @@ -51,10 +77,21 @@ jobs: steps: - name: Comment on PR with URL - uses: unsplash/comment-on-pr@v1.3.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/github-script@v7 with: - msg: "Created review app at https://review.submit-social-housing-data.communities.gov.uk/${{ github.event.pull_request.number }}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again." - check_for_duplicate_msg: true - duplicate_msg_pattern: Created review app at* + script: | + const prNumber = context.issue.number; + const msg = `Created review app at https://review.submit-social-housing-data.communities.gov.uk/${prNumber}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again.`; + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + if (!comments.find(c => c.body.startsWith('Created review app at'))) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: msg, + }); + }