ENG-308: add JIRA validation workflow for pull request titles#16358
ENG-308: add JIRA validation workflow for pull request titles#16358abhimanyurajeesh wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdds 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. ChangesPR Title JIRA Validation
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🎭 Playwright Test ResultsStatus: ⏭️ Skipped No test-related files were changed in this PR. Tests are skipped when changes don't affect:
Run: #8835 |
There was a problem hiding this comment.
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_dispatchworkflow 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.
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/pr-title-jira.yml
|
✅ JIRA Validation Passed Found JIRA ticket: ENG-308 |
Deploying care-preview with
|
| 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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/pr-title-jira.yml
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
Summary by CodeRabbit