Browse Source

CLDC-4263: add descriptive comment

pull/3233/head
Nat Dean-Lewis 5 days ago
parent
commit
0372a51938
  1. 49
      .github/workflows/review_pipeline.yml

49
.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,
});
}

Loading…
Cancel
Save