Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/pr-file-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- 'labeled'
- 'unlabeled'

permissions:
contents: read
pull-requests: write

jobs:
changed-files-in-pr:
name: 'Check for changed files'
Expand Down Expand Up @@ -41,11 +45,19 @@ jobs:
skip-label: 'skip tests'
failure-message: 'TypeScript code was edited without also editing a ${file-pattern} file; see the Testing page in our wiki on testing guidelines (the ${skip-label} label can be used to pass this check)'

- name: Add "issue-please" Label
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'issue-please'
- name: 'Ensure PR has an associated issue'
uses: actions/github-script@v6
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
if (labels.includes('issue-please')) {
core.setFailed('The "issue-please" label is present. Please associate an issue and remove the label.');
}
if (!labels.includes('skip-issue-check')) {
const issueLink = context.payload.pull_request.body.match(/https:\/\/github\.com\/\S+\/issues\/\d+/);
if (!issueLink) {
Expand Down
Loading