File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 4343 steps :
4444 - name : 🏷️ Validate JIRA ticket ID in PR title
4545 shell : bash
46+ env :
47+ GH_TOKEN : ${{ github.token }}
4648 run : |
4749 # Get PR title from context or input parameter (for pull_request_target support)
4850 if [[ -n "${{ inputs.pr-title }}" ]]; then
5254 PR_TITLE="${{ github.event.pull_request.title }}"
5355 echo "Using PR title from GitHub event context"
5456 fi
57+
58+ # Fetch the current PR title from the API to handle re-runs correctly.
59+ # When a workflow is re-run (either directly or via a reusable workflow caller),
60+ # the event payload contains the title from the original trigger, not the current
61+ # state. If the user edited the title (e.g., to add a JIRA ID), we need to detect
62+ # that and use the updated title instead.
63+ PR_NUMBER="${{ github.event.pull_request.number }}"
64+ if [[ -n "$PR_NUMBER" ]]; then
65+ LIVE_TITLE=$(gh pr view "$PR_NUMBER" \
66+ --repo "${{ github.repository }}" \
67+ --json title --jq '.title' 2>/dev/null || true)
68+
69+ if [[ -n "$LIVE_TITLE" && "$LIVE_TITLE" != "$PR_TITLE" ]]; then
70+ echo "⚠️ PR title was updated since workflow was triggered"
71+ echo " Event title: $PR_TITLE"
72+ echo " Current title: $LIVE_TITLE"
73+ PR_TITLE="$LIVE_TITLE"
74+ fi
75+ fi
5576 echo "PR Title: $PR_TITLE"
5677
5778 # Set up inputs as environment variables
You can’t perform that action at this time.
0 commit comments