Skip to content

ENG-308: add JIRA validation workflow for pull request titles#16358

Open
abhimanyurajeesh wants to merge 3 commits into
developfrom
git-checkout--b-ENG-308-create-action-for-checking-jira-id-in-pr
Open

ENG-308: add JIRA validation workflow for pull request titles#16358
abhimanyurajeesh wants to merge 3 commits into
developfrom
git-checkout--b-ENG-308-create-action-for-checking-jira-id-in-pr

Conversation

@abhimanyurajeesh
Copy link
Copy Markdown
Contributor

@abhimanyurajeesh abhimanyurajeesh commented May 15, 2026

Proposed Changes

Fixes # https://openhealthcarenetwork.atlassian.net/browse/ENG-308

Validates that Pull Request titles contain a valid JIRA ticket (e.g., CARE-123 or ENG-456). If missing, the workflow checks the branch name and automatically updates the PR title when possible. It also posts validation results as a PR comment and fails the workflow if no valid ticket is found.

Note: Branch name was intended for testing purposes.

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

  • Chores
    • Added automated validation to ensure PR titles include valid JIRA ticket references in KEY-123 format (case-insensitive, configured project keys).
    • Automatically prepends a detected ticket from the branch name to the PR title when missing.
    • Posts bot comments on PRs indicating success or showing required format/examples on failure.
    • Skips bot-created and forked PRs when running validation.

Review Change Stack

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 321c1c8
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/6a06ed8a14052e0008050d16
😎 Deploy Preview https://deploy-preview-16358.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Walkthrough

Adds a GitHub Actions workflow that validates PR titles (or branch names) for JIRA tickets matching CARE/ENG (case-insensitive KEY-), prefixes the PR title when extracting a ticket from the branch, and posts or updates an idempotent bot comment with success or failure details.

Changes

PR Title JIRA Validation

Layer / File(s) Summary
Workflow triggers and job configuration
.github/workflows/pr-title-jira.yml (lines 1–20)
Defines pull_request triggers (opened, reopened, edited), grants permissions.pull-requests: write, and configures the job if: condition to skip bot-authored and fork PRs.
JIRA pattern and comment helper
.github/workflows/pr-title-jira.yml (lines 24–60)
Defines the list of JIRA project keys and builds a case-insensitive regex for KEY-<number> tickets; implements upsertComment to find and create/update a single bot-marked comment.
Title/branch validation, update, and failure handling
.github/workflows/pr-title-jira.yml (lines 62–106)
Checks the PR title for a matching ticket and upserts a success comment if found; otherwise checks the branch name, prefixes the PR title with the ticket when found and upserts success; on failure upserts a failure comment with expected format/examples and marks the workflow failed.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title 'ENG-308: add JIRA validation workflow for pull request titles' directly and clearly describes the main change—adding a GitHub Actions workflow for JIRA validation.
Description check ✅ Passed The PR description follows the required template structure with Proposed Changes, related issue reference, tagging, and a completed Merge Checklist. The description clearly explains the workflow purpose and functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch git-checkout--b-ENG-308-create-action-for-checking-jira-id-in-pr

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

🎭 Playwright Test Results

Status: ⏭️ Skipped

No test-related files were changed in this PR.

Tests are skipped when changes don't affect:

  • tests/**
  • src/**
  • package.json
  • playwright.config.ts

Run: #8835

@abhimanyurajeesh abhimanyurajeesh changed the title feat: add JIRA validation workflow for pull request titles ENG-308 : feat: add JIRA validation workflow for pull request titles May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions workflow to enforce that PR titles include a valid JIRA ticket (currently CARE-* or ENG-*), optionally deriving the ticket from the branch name and posting the validation outcome as a PR comment.

Changes:

  • Introduces a pull_request_target + workflow_dispatch workflow to validate PR titles for configured JIRA keys.
  • Auto-updates the PR title when a valid ticket is found in the branch name.
  • Posts/updates a single bot comment with validation results and fails the workflow when no ticket is found.

Comment thread .github/workflows/pr-title-jira.yml
Comment thread .github/workflows/pr-title-jira.yml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-title-jira.yml:
- Around line 20-24: The current if condition lets workflow_dispatch bypass the
bot/fork guard; change the condition so workflow_dispatch runs still enforce the
PR user/type and repo checks by requiring the event is either workflow_dispatch
or pull_request AND the bot/fork guard holds. Concretely, replace the existing
predicate (the block containing github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.user.type != 'Bot' &&
github.event.pull_request.head.repo.full_name == github.repository)) with a
combined form like (github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request') && (github.event.pull_request.user.type !=
'Bot' && github.event.pull_request.head.repo.full_name == github.repository),
and apply the same change to the similar conditional covering lines 35-48.
- Around line 57-83: The upsertComment helper is not idempotent because it only
lists one page of comments and matches the marker without checking author;
change upsertComment to use github.paginate to fetch all comments for the PR
(replace the github.rest.issues.listComments call with
github.paginate(github.rest.issues.listComments, { owner, repo, issue_number:
prNumber })) and then filter those comments to find ones that both include the
marker and are from a bot account (e.g., comment.user.type === 'Bot' or
comment.user.login.endsWith('[bot]')), pick the most appropriate existing bot
comment (e.g., the most recent), and update that comment via
github.rest.issues.updateComment if found; otherwise create a new comment with
github.rest.issues.createComment as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0630e708-6595-428b-ae61-206d52a9f7e9

📥 Commits

Reviewing files that changed from the base of the PR and between 2b8b2d9 and 0f7e39f.

📒 Files selected for processing (1)
  • .github/workflows/pr-title-jira.yml

Comment thread .github/workflows/pr-title-jira.yml
Comment thread .github/workflows/pr-title-jira.yml
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

JIRA Validation Passed

Found JIRA ticket: ENG-308

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 15, 2026

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 321c1c8
Status: ✅  Deploy successful!
Preview URL: https://7a6d1b58.care-preview-a7w.pages.dev
Branch Preview URL: https://git-checkout--b-eng-308-crea.care-preview-a7w.pages.dev

View logs

Copilot AI review requested due to automatic review settings May 15, 2026 09:55
Comment thread .github/workflows/pr-title-jira.yml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/pr-title-jira.yml
Comment thread .github/workflows/pr-title-jira.yml
Comment thread .github/workflows/pr-title-jira.yml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-title-jira.yml:
- Around line 7-8: The workflow's permissions only grant pull-requests: write
but the job uses Issues comment APIs (listComments, updateComment,
createComment), causing permission errors; update the permissions block by
adding issues: write alongside pull-requests: write so the Actions runner can
call the issue comment endpoints (i.e., modify the permissions stanza that
contains "pull-requests: write" to also include "issues: write").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8bae6f0f-f767-4a07-86bb-ef15b6c5f734

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab8849 and 321c1c8.

📒 Files selected for processing (1)
  • .github/workflows/pr-title-jira.yml

Comment thread .github/workflows/pr-title-jira.yml
@abhimanyurajeesh abhimanyurajeesh changed the title ENG-308 : feat: add JIRA validation workflow for pull request titles add JIRA validation workflow for pull request titles May 15, 2026
@github-actions github-actions Bot changed the title add JIRA validation workflow for pull request titles ENG-308: add JIRA validation workflow for pull request titles May 15, 2026
@yash-learner yash-learner changed the title ENG-308: add JIRA validation workflow for pull request titles add JIRA validation workflow for pull request titles May 15, 2026
@github-actions github-actions Bot changed the title add JIRA validation workflow for pull request titles ENG-308: add JIRA validation workflow for pull request titles May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants