Skip to content

fix: validate ADDON Jira ticket in PR title#511

Merged
mkolasinski-splunk merged 7 commits into
developfrom
feat/validate-addon-jira-ticket-in-pr-title
Jul 15, 2026
Merged

fix: validate ADDON Jira ticket in PR title#511
mkolasinski-splunk merged 7 commits into
developfrom
feat/validate-addon-jira-ticket-in-pr-title

Conversation

@mkolasinski-splunk

@mkolasinski-splunk mkolasinski-splunk commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a step to the validate-pr-title job that enforces ADDON-XXXXX (5–6 digit Jira ticket number) in the PR title, failing with a clear ::error:: annotation if missing (runs after the existing semantic PR title check).
  • Adds a new comment-on-jira job: on push to main/develop, scans commit messages for ADDON-XXXXX references and posts a comment on each referenced ticket linking back to the commit (and originating PR, if found), worded to match the existing GitLab→Jira integration convention ({author} mentioned this issue in a commit of {repo} on branch {branch}:).
  • Auth via ATLASSIAN_EMAIL/ATLASSIAN_TOKEN secrets (hardcoded https://splunk.atlassian.net base URL), matching the naming convention already used by addonfactory-docs-on-github-integration; posts via raw Jira REST API v3 + ADF body rather than atlassian/gajira-comment (which has a known RCE, CVE-2020-14189).
  • Never fails the workflow: a failed Jira API call only logs a ::warning::.

Test plan

  • Open a PR without ADDON-XXXXX in the title → job fails with the error message
  • Open a PR with ADDON-12345 or ADDON-123456 in the title → job passes
  • Verify existing semantic PR title validation still works
  • Live end-to-end verification against splunk/test-addonfactory-repo (sandbox repo, temporarily pointed at this branch, reverted to v5.4 after each round), commenting on real ticket ADDON-88759:
    • pull_request event → comment-on-jira correctly skipped (job only fires on push)
    • Push directly to main, no originating PR → comment posted with commit link only, no "via PR" clause (run)
    • Push to main via squash-merged PR → comment posted with commit link and correct PR link (run, PR #374)
    • Push with a mix of a ticket-referencing and a non-referencing commit → only the referencing commit produced a comment (dedup/skip logic confirmed) (run)
    • Bug found and fixed during testing: initial run 403'd on the PR lookup (job only had contents: read) and leaked the raw error JSON into the comment's link href (run, see resulting malformed comment) — fixed by adding pull-requests: read and guarding the gh api failure path (1c8ba82)
    • Final wording verified live: "mkolasinski-splunk mentioned this issue in a commit of splunk/test-addonfactory-repo on branch main:" (run)

🤖 Generated with Claude Code

Add a step to the validate-pr-title job that checks for ADDON-XXXXX
(5-6 digit number) in the PR title, failing with a clear error message
if missing.

Co-Authored-By: Claude <noreply@anthropic.com>
@mkolasinski-splunk
mkolasinski-splunk requested a review from a team as a code owner July 3, 2026 10:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d982f008d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/reusable-build-test-release.yml Outdated
Comment thread .github/workflows/reusable-build-test-release.yml Outdated
@mkolasinski-splunk mkolasinski-splunk changed the title feat: validate ADDON Jira ticket in PR title fix: validate ADDON Jira ticket in PR title Jul 6, 2026
- Pass the PR title through env: instead of interpolating it into the
  run: script text, so a crafted title can't trigger command
  substitution on the runner.
- Anchor the ticket regex so a longer digit run (e.g. ADDON-1234567)
  no longer satisfies the check via its 5-6 digit prefix.
Adds a comment-on-jira job that posts a link back to the commit (and
originating PR, if found) on any ADDON-XXXXX ticket referenced in a
commit pushed to main/develop, giving reporters visibility into when
their fix landed.

Uses the Jira REST API directly via curl rather than a third-party
comment action (atlassian/gajira-comment has a known RCE, CVE-2020-14189).
Requires new JIRA_BASE_URL/JIRA_USER_EMAIL/JIRA_API_TOKEN secrets;
consuming repos need these added before bumping to the next tag.
addonfactory-docs-on-github-integration and issue-exploder already use
ATLASSIAN_EMAIL/ATLASSIAN_TOKEN (or JIRA_LOGIN/JIRA_API_TOKEN) against a
hardcoded splunk.atlassian.net rather than a configurable base URL.
Match that instead of introducing new JIRA_* secret names.
…a comments

Live test against test-addonfactory-repo (push to main, ADDON-88759)
showed the PR lookup 403ing (job only had contents:read) and, because
gh api's stderr/stdout still populated PR_URL before the `|| true`
swallowed the exit code, the raw JSON error body got embedded as the
"PR" link href in the posted Jira comment.
Reword the posted comment to "{author} mentioned this issue in a commit
of {repo} on branch {branch}:" followed by the commit/PR links, matching
the phrasing already used by the existing GitLab->Jira integration
(srv-ssc-gitlab) so both integrations read consistently on a ticket.
Comment thread .github/workflows/reusable-build-test-release.yml
Comment thread .github/workflows/reusable-build-test-release.yml

@rasteja rasteja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this workflow now requires two new Jira credentials—ATLASSIAN_EMAIL and ATLASSIAN_TOKEN—but the
workflows that call it have not yet been updated to provide them. Until those callers are updated, existing workflows
may fail before they start.

Comment thread .github/workflows/reusable-build-test-release.yml Outdated
The Jira comment job only matched the first line of the commit message
and the first regex match, so pushes referencing multiple tickets (or a
ticket outside the first line) only got a comment on one.

@rasteja rasteja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One required caller-contract issue needs resolution before rollout.

Comment thread .github/workflows/reusable-build-test-release.yml

@rasteja rasteja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The Jira ticket-reference handling is fixed, and the required-secret rollout is tracked in ADDON-89095.

@mkolasinski-splunk
mkolasinski-splunk merged commit 99ee1ed into develop Jul 15, 2026
6 checks passed
@mkolasinski-splunk
mkolasinski-splunk deleted the feat/validate-addon-jira-ticket-in-pr-title branch July 15, 2026 13:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants