File tree Expand file tree Collapse file tree 2 files changed +36
-26
lines changed Expand file tree Collapse file tree 2 files changed +36
-26
lines changed Original file line number Diff line number Diff line change 1+ name : Linked Issue
2+
3+ on :
4+ pull_request :
5+ types : [opened, edited]
6+
7+ env :
8+ VALID_ISSUE_PREFIXES : " CNCT|DASH"
9+
10+ jobs :
11+ linear :
12+ name : Linear
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Check for linked issue
16+ uses : actions/github-script@v7
17+ with :
18+ script : |
19+ const pr = await github.rest.pulls.get({
20+ owner: context.repo.owner,
21+ repo: context.repo.repo,
22+ pull_number: context.issue.number
23+ });
24+
25+ const body = pr.data.body || '';
26+ const issueRegex = new RegExp(`(${process.env.VALID_ISSUE_PREFIXES})-\\d+`, 'i');
27+
28+ if (!issueRegex.test(body)) {
29+ core.setFailed(
30+ `No valid issue reference found. PR body must contain an issue ID with one of these prefixes: ${process.env.VALID_ISSUE_PREFIXES}`
31+ );
32+ return;
33+ }
34+
35+ const matches = body.match(issueRegex);
36+ console.log(`Found issue reference: ${matches[0]}`);
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments