Skip to content

Commit 1cff976

Browse files
committed
fixes
1 parent b7a7229 commit 1cff976

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

.github/workflows/deploy-to-control-plane-review.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,23 @@ on:
66
issue_comment:
77
types: [created]
88

9+
# Use concurrency to cancel in-progress runs
10+
concurrency:
11+
group: deploy-${{ github.event.pull_request.number || github.event.issue.number }}
12+
cancel-in-progress: true
13+
914
env:
1015
APP_NAME: qa-react-webpack-rails-tutorial-pr-${{ github.event.pull_request.number || github.event.issue.number }}
1116
CPLN_ORG: ${{ secrets.CPLN_ORG }}
1217
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
1318

1419
jobs:
15-
check-concurrent:
16-
name: Check concurrent deployments
17-
runs-on: ubuntu-latest
18-
outputs:
19-
cancelled: ${{ steps.check.outputs.cancelled }}
20-
steps:
21-
- uses: actions/github-script@v7
22-
id: check
23-
with:
24-
script: |
25-
const runs = await github.rest.actions.listWorkflowRuns({
26-
owner: context.repo.owner,
27-
repo: context.repo.repo,
28-
workflow_id: context.workflow,
29-
status: 'in_progress',
30-
branch: context.payload.pull_request?.head.ref
31-
});
32-
core.setOutput('cancelled', runs.data.total_count > 1 ? 'true' : 'false');
33-
3420
deploy:
35-
needs: check-concurrent
3621
if: |
37-
needs.check-concurrent.outputs.cancelled != 'true' &&
38-
((github.event_name == 'pull_request') ||
39-
(github.event_name == 'issue_comment' && github.event.comment.body == '/deploy-review-app'))
22+
github.event_name == 'pull_request' ||
23+
(github.event_name == 'issue_comment' &&
24+
github.event.comment.body == '/deploy-review-app' &&
25+
github.event.issue.pull_request)
4026
runs-on: ubuntu-latest
4127
permissions:
4228
contents: read

0 commit comments

Comments
 (0)