Skip to content

Commit

Permalink
Update check-linked-issue.js
Browse files Browse the repository at this point in the history
  • Loading branch information
t-will-gillis authored Aug 6, 2024
1 parent 8b63514 commit 6dca027
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion github-actions/trigger-pr/check-linked-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ async function main({ g, c }) {
const prOwner = context.payload.pull_request.user.login;
const regex = /(?!<!--)(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\s*#(\d+)(?![^<]*-->)/gi;
const match = prBody.match(regex);

let prComment;

if (!match) {
console.log('PR does not have a properly linked issue. Posting comment...');
prComment = `@${prOwner}, this Pull Request is not linked to a valid issue. Please provide a valid linked issue above in the format of 'Fixes #' + issue number, for example 'Fixes #9876'`;
}
console.log(match);

else {
console.log(match);
let [ , keyword, linkNumber ] = match;
console.log('Found a keyword: \'' + keyword + '\'. Checking for legitimate linked issue...');

Expand Down

0 comments on commit 6dca027

Please sign in to comment.