Skip to content

Commit 2cfb1b9

Browse files
committed
separate out file check
1 parent 0e3cc19 commit 2cfb1b9

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

.github/workflows/pr-file-check.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,3 @@ jobs:
4242
.github/test_plan.md
4343
skip-label: 'skip tests'
4444
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)'
45-
46-
- name: 'Ensure PR has an associated issue'
47-
uses: actions/github-script@v8
48-
with:
49-
script: |
50-
const labels = context.payload.pull_request.labels.map(label => label.name);
51-
if (!labels.includes('skip-issue-check')) {
52-
const prBody = context.payload.pull_request.body || '';
53-
const issueLink = prBody.match(/https:\/\/github\.com\/\S+\/issues\/\d+/);
54-
const issueReference = prBody.match(/#\d+/);
55-
if (!issueLink && !issueReference) {
56-
core.setFailed('No associated issue found in the PR description.');
57-
}
58-
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PR issue check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- 'opened'
7+
- 'reopened'
8+
- 'synchronize'
9+
- 'labeled'
10+
- 'unlabeled'
11+
12+
permissions: {}
13+
14+
jobs:
15+
check-for-attached-issue:
16+
name: 'Check for attached issue'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'Ensure PR has an associated issue'
20+
uses: actions/github-script@v8
21+
with:
22+
script: |
23+
const labels = context.payload.pull_request.labels.map(label => label.name);
24+
if (!labels.includes('skip-issue-check')) {
25+
const prBody = context.payload.pull_request.body || '';
26+
const issueLink = prBody.match(/https:\/\/github\.com\/\S+\/issues\/\d+/);
27+
const issueReference = prBody.match(/#\d+/);
28+
if (!issueLink && !issueReference) {
29+
core.setFailed('No associated issue found in the PR description.');
30+
}
31+
}

0 commit comments

Comments
 (0)