chore(deps): update actions/github-script action to v9 #126
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Checks | |
| on: | |
| workflow_call: | |
| inputs: | |
| next-release-label-check: | |
| type: boolean | |
| default: false | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| next-release-label-check: | |
| name: Check for "next release" label | |
| runs-on: ubuntu-latest | |
| if: inputs.next-release-label-check | |
| steps: | |
| - | |
| name: Check for "next release" label | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const { data: pulls } = await github.rest.pulls.list({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| }); | |
| // check for open PRs which contain the 'next release' label | |
| const openPRs = pulls.filter(pr => | |
| pr.labels.some(label => label.name === 'next release') | |
| ).map(pr => ` - #${pr.number}: ${pr.title}`); | |
| if (openPRs.length > 0) { | |
| const errorMessage = 'Found "next release" label on the following open pull requests:\n' | |
| + openPRs.join('\n') | |
| + '\nPlease merge them before release.'; | |
| core.setFailed(errorMessage); | |
| } else { | |
| console.log('No "next release" label found on any open pull requests!'); | |
| } |