Skip to content

Commit d7df427

Browse files
committed
ci: enhance PR issue link check script
1 parent fe012d5 commit d7df427

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

.github/workflows/pr-issue-link-check.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,32 @@ jobs:
3232
const hasTitleIssueReference = titleIssueRegex.test(prTitle);
3333
3434
if (!hasIssueReference && !hasTitleIssueReference) {
35+
// Create the comment body
36+
const commentBody = [
37+
'⚠️ **PR Must Reference an Issue**',
38+
'',
39+
"This pull request doesn't reference any issue. Please link your PR to an existing issue by:",
40+
'',
41+
'1. Adding one of the following keywords in your PR description followed by the issue number:',
42+
' - fixes #123',
43+
' - closes #123',
44+
' - resolves #123',
45+
' - refs #123',
46+
' - references #123',
47+
'',
48+
'2. Or including the issue number in the PR title like:',
49+
' - [FEATURE] Add new feature #123',
50+
' - [BUG] Fix critical bug #123',
51+
'',
52+
`If no issue exists for this change, please [create an issue](https://github.com/${context.repo.owner}/${context.repo.repo}/issues/new) first to describe the problem or feature request.`
53+
].join('\n');
54+
3555
// Add comment asking to link an issue
3656
await github.rest.issues.createComment({
3757
owner: context.repo.owner,
3858
repo: context.repo.repo,
3959
issue_number: context.issue.number,
40-
body: \`⚠️ **PR Must Reference an Issue**
41-
42-
This pull request doesn't reference any issue. Please link your PR to an existing issue by:
43-
44-
1. Adding one of the following keywords in your PR description followed by the issue number:
45-
- fixes #123
46-
- closes #123
47-
- resolves #123
48-
- refs #123
49-
- references #123
50-
51-
2. Or including the issue number in the PR title like:
52-
- [FEATURE] Add new feature #123
53-
- [BUG] Fix critical bug #123
54-
55-
If no issue exists for this change, please [create an issue](https://github.com/\${context.repo.owner}/\${context.repo.repo}/issues/new) first to describe the problem or feature request.\`
60+
body: commentBody
5661
});
5762
5863
// Fail the check

0 commit comments

Comments
 (0)