diff --git a/.github/scripts/story_link_check.sh b/.github/scripts/story_link_check.sh index 67c3ce549d7..facb9ca15dc 100755 --- a/.github/scripts/story_link_check.sh +++ b/.github/scripts/story_link_check.sh @@ -1,13 +1,30 @@ #!/bin/bash +set -e -link="$1" +PR_BODY="$1" -story_regex="https:\/\/app.shortcut.com\/simpledotorg\/story\/[0-9]+(\/.*)?" +JIRA_KEY_REGEX='[A-Z][A-Z0-9]+-[0-9]+' -if [[ "$link" =~ $story_regex ]]; then - echo "PR description contains a valid story link." +echo "🔍 Verifying Jira reference..." + +# 1. Check PR body +if [[ "$PR_BODY" =~ $JIRA_KEY_REGEX ]]; then + echo "✅ Jira key found in PR description" + exit 0 +fi + +# 2. Check PR title +if [[ "$GITHUB_PR_TITLE" =~ $JIRA_KEY_REGEX ]]; then + echo "✅ Jira key found in PR title" exit 0 -else - echo "PR description doesn't contain any valid story links." - exit 1 fi + +# 3. Check branch name +if [[ "$GITHUB_HEAD_REF" =~ $JIRA_KEY_REGEX ]]; then + echo "✅ Jira key found in branch name" + exit 0 +fi + +echo "❌ No Jira issue key found." +echo "Expected something like ENG-1234 in branch name, PR title, PR description." +exit 1 diff --git a/.github/workflows/ci_checks.yml b/.github/workflows/ci_checks.yml index 36585e88e76..b89531065fd 100644 --- a/.github/workflows/ci_checks.yml +++ b/.github/workflows/ci_checks.yml @@ -14,12 +14,15 @@ concurrency: cancel-in-progress: true jobs: - verify_pr_has_story_link: + verify_pr_has_jira_reference: runs-on: [ ubuntu-latest ] if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v6 - - name: Verify PR description + - name: Verify PR has Jira reference + env: + GITHUB_PR_TITLE: ${{ github.event.pull_request.title }} + GITHUB_HEAD_REF: ${{ github.head_ref }} run: .github/scripts/story_link_check.sh '${{ github.event.pull_request.body }}' verify_changelog_was_updated: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bac28bdafb..802700cbac4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next Release +### Internal + +-Update `ci-checks.yml` & `story-link-check.sh` to verify valid jira reference + ## 2026.02.02 ### Internal