Skip to content

RHCLOUD-44550: Add action to validate JIRA cards in titles#1156

Merged
tylercreller merged 3 commits intoproject-kessel:mainfrom
tylercreller:naive-jira-action
Jan 28, 2026
Merged

RHCLOUD-44550: Add action to validate JIRA cards in titles#1156
tylercreller merged 3 commits intoproject-kessel:mainfrom
tylercreller:naive-jira-action

Conversation

@tylercreller
Copy link
Copy Markdown
Member

@tylercreller tylercreller commented Jan 26, 2026

Adds a naive implementation of validating JIRA cards in titles of PRs

Summary by Sourcery

CI:

  • Add a GitHub Actions workflow that fails pull requests whose titles do not contain a JIRA-style issue key (e.g., ABC-123).

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jan 26, 2026

Reviewer's Guide

Adds a GitHub Actions workflow that enforces presence of a JIRA-style ticket ID in pull request titles using a simple regex check.

Sequence diagram for GitHub PR JIRA title validation workflow

sequenceDiagram
  actor Developer
  participant GitHub
  participant Workflow_jira_check

  Developer->>GitHub: Open pull_request
  GitHub->>Workflow_jira_check: Trigger jira-check workflow on pull_request
  Workflow_jira_check->>Workflow_jira_check: Read env PR_TITLE
  alt PR_TITLE matches [A-Z]+-[0-9]+
    Workflow_jira_check-->>GitHub: Job succeeds (JIRA card found)
    GitHub-->>Developer: PR checks pass
  else PR_TITLE does not match
    Workflow_jira_check-->>GitHub: Job fails (exit 1)
    GitHub-->>Developer: PR checks fail with error message
  end
Loading

File-Level Changes

Change Details Files
Introduce a GitHub Actions workflow to validate that PR titles contain a JIRA ticket ID.
  • Create a jira-check workflow triggered on pull_request events
  • Configure minimal read permissions for contents and pull-requests
  • Add a job that checks the PR title against a JIRA-like pattern using a bash regex and fails the workflow if no match is found
  • Print informative messages indicating whether a JIRA card was detected and what format is expected
.github/workflows/jira-check.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The JIRA key regex [A-Z]+-[0-9]+ is very permissive; consider anchoring it (e.g., ^RHCLOUD-[0-9]+) or otherwise constraining it so that only valid project keys and formats are accepted and you avoid accidental matches in arbitrary uppercase text.
  • You can scope the workflow trigger to only relevant pull request events (e.g., on: pull_request: types: [opened, edited, reopened, ready_for_review]) to avoid running the check on events where the title cannot change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The JIRA key regex `[A-Z]+-[0-9]+` is very permissive; consider anchoring it (e.g., `^RHCLOUD-[0-9]+`) or otherwise constraining it so that only valid project keys and formats are accepted and you avoid accidental matches in arbitrary uppercase text.
- You can scope the workflow trigger to only relevant pull request events (e.g., `on: pull_request: types: [opened, edited, reopened, ready_for_review]`) to avoid running the check on events where the title cannot change.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@tylercreller tylercreller changed the title Add action to validate JIRA cards in titles NOJIRA-1234: Add action to validate JIRA cards in titles Jan 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
main 46.39% <ø> (+0.01%) ⬆️
v1beta2 56.92% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tylercreller tylercreller changed the title NOJIRA-1234: Add action to validate JIRA cards in titles RHCLOUD-44550: Add action to validate JIRA cards in titles Jan 26, 2026
@tylercreller tylercreller changed the title RHCLOUD-44550: Add action to validate JIRA cards in titles Add action to validate JIRA cards in titles Jan 26, 2026
@tylercreller tylercreller force-pushed the naive-jira-action branch 6 times, most recently from 81f54f7 to 346700e Compare January 26, 2026 21:30
@tylercreller tylercreller changed the title Add action to validate JIRA cards in titles RHCLOUD-44550: Add action to validate JIRA cards in titles Jan 26, 2026
Copy link
Copy Markdown
Contributor

@lennysgarage lennysgarage left a comment

Choose a reason for hiding this comment

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

LGTM

@tylercreller tylercreller merged commit bc350ce into project-kessel:main Jan 28, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants