Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/scripts/trigger-CI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COMMIT_ID=$1
SECURITY=$2
REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"
PROJECT_ID="3567319"
BRANCH_REF="github-intern"
BRANCH_REF="master"
CANCEL_IN_PROGRESS="true"
PIPELINE_ID="42305"
GITHUB_COMMIT_ID="${COMMIT_ID}"
Expand Down
60 changes: 0 additions & 60 deletions .github/scripts/trigger-merge.sh

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/merge-request-trigger.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/pr-issue-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: PR Issue Link Check

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
check-issue-link:
runs-on: ubuntu-latest
if: github.event.action == 'opened' || github.event.action == 'edited'

steps:
- name: Check if PR references an issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});

// Check PR body for issue references
const prBody = pr.body || '';
const issueRegex = /(fixes|fix|closes|close|resolves|resolve|refs|references)\s+#(\d+)/gi;
const hasIssueReference = issueRegex.test(prBody);

// Check PR title for issue references
const prTitle = pr.title || '';
const titleIssueRegex = /#\d+/g;
const hasTitleIssueReference = titleIssueRegex.test(prTitle);

if (!hasIssueReference && !hasTitleIssueReference) {
// Create the comment body
const commentBody = [
'⚠️ **PR Must Reference an Issue**',
'',
"This pull request doesn't reference any issue. Please link your PR to an existing issue by:",
'',
'1. Adding one of the following keywords in your PR description followed by the issue number:',
' - fixes #123',
' - closes #123',
' - resolves #123',
' - refs #123',
' - references #123',
'',
'2. Or including the issue number in the PR title like:',
' - [FEATURE] Add new feature #123',
' - [BUG] Fix critical bug #123',
'',
`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.`
].join('\n');

// Add comment asking to link an issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});

// Fail the check
core.setFailed('PR must reference an issue');
} else {
console.log('✅ PR properly references an issue');
}
Loading