Skip to content

Commit

Permalink
PP-11314 harden release workflow
Browse files Browse the repository at this point in the history
- check for concourse user when determining release workflow trigger
- prevent other merges when there is an open release pr
  • Loading branch information
nlsteers committed Aug 21, 2023
1 parent 010a7d9 commit ae833d1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/prevent-merge-if-release-open.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check for unmerged release PR

on:
pull_request:

permissions:
pull-requests: read

jobs:
check_merge:
runs-on: ubuntu-latest
steps:
- name: Check for unmerged release
id: check_pr
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prs = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
})
const openRelease = prs.data.find(pr => pr.user.login === 'alphagov-pay-ci-concourse' && pr.state === 'open')
if (openRelease) {
core.setFailed('There is an unmerged release PR, please merge it before merging this PR.')
}

0 comments on commit ae833d1

Please sign in to comment.