Browse Source

CLDC-4263: separate comment workflow

pull/3234/head
Nat Dean-Lewis 5 days ago
parent
commit
ee43b3ec76
  1. 24
      .github/workflows/review_app_hint.yml
  2. 27
      .github/workflows/review_pipeline.yml

24
.github/workflows/review_app_hint.yml

@ -0,0 +1,24 @@
name: Review app hint
on:
pull_request:
types: [opened]
jobs:
hint:
name: Add review app hint
if: "!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: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'To deploy a review app for this PR, add the `deploy-review` label.',
});

27
.github/workflows/review_pipeline.yml

@ -6,7 +6,6 @@ concurrency:
on: on:
pull_request: pull_request:
types: types:
- opened
- synchronize - synchronize
- reopened - reopened
- labeled - labeled
@ -17,32 +16,6 @@ defaults:
shell: bash shell: bash
jobs: 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: infra:
name: Deploy review app infrastructure name: Deploy review app infrastructure
if: contains(github.event.pull_request.labels.*.name, 'deploy-review') if: contains(github.event.pull_request.labels.*.name, 'deploy-review')

Loading…
Cancel
Save