Browse Source

CLDC-4136: don't allow manual teardown to avoid unnecessary edge cases

pull/3227/head
Nat Dean-Lewis 1 week ago
parent
commit
c9ca191dae
  1. 20
      .github/workflows/manual_review_code_pipeline.yml
  2. 21
      .github/workflows/review_pipeline.yml

20
.github/workflows/manual_review_code_pipeline.yml

@ -16,8 +16,27 @@ defaults:
shell: bash
jobs:
get_pr_head_sha:
name: Get PR HEAD SHA
runs-on: ubuntu-latest
outputs:
pr_head_sha: ${{ steps.get_sha.outputs.pr_head_sha }}
steps:
- name: Get PR HEAD SHA
id: get_sha
uses: actions/github-script@v7
with:
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt('${{ inputs.pr_number }}'),
});
core.setOutput('pr_head_sha', pr.head.sha);
code:
name: Deploy review app code
needs: [get_pr_head_sha]
uses: ./.github/workflows/aws_deploy.yml
with:
aws_account_id: 837698168072
@ -25,5 +44,6 @@ jobs:
aws_task_prefix: core-review-${{ inputs.pr_number }}
concurrency_tag: ${{ inputs.pr_number }}
environment: review
ref: ${{ needs.get_pr_head_sha.outputs.pr_head_sha }}
permissions:
id-token: write

21
.github/workflows/review_pipeline.yml

@ -53,7 +53,7 @@ jobs:
needs: [get_pr_details]
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: read
outputs:
started: ${{ steps.check.outputs.started }}
steps:
@ -63,24 +63,13 @@ jobs:
with:
script: |
const prNumber = '${{ needs.get_pr_details.outputs.pr_number }}';
const { data: runs } = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'review_pipeline.yml',
event: 'issue_comment',
});
const { data: dispatchRuns } = await github.rest.actions.listWorkflowRuns({
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'review_pipeline.yml',
event: 'workflow_dispatch',
issue_number: parseInt(prNumber),
});
const allRuns = [...runs.workflow_runs, ...dispatchRuns.workflow_runs];
const prRun = allRuns.find(run =>
run.display_title.includes(`#${prNumber}`) ||
run.head_branch === context.payload.pull_request.head.ref
);
core.setOutput('started', prRun ? 'true' : 'false');
const deployComment = comments.find(c => c.body === 'Starting review app deployment...');
core.setOutput('started', deployComment ? 'true' : 'false');
deployment_started_comment:
name: Comment deployment started

Loading…
Cancel
Save