feat(check-jira-reference): extract Jira check into composite action#11
Open
GoogilyBoogily wants to merge 1 commit into
Open
feat(check-jira-reference): extract Jira check into composite action#11GoogilyBoogily wants to merge 1 commit into
GoogilyBoogily wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extracts the Jira ticket body validation from the reusable PR title/Jira workflow into a dedicated composite action backed by a TypeScript script, while threading the existing jira-url-pattern input through to the check.
Changes:
- Adds
src/check-jira-reference.tsand generateddist/check-jira-reference.js. - Adds
actions/check-jira-referenceas a reusable composite action. - Replaces the inline Jira body grep in
pr-title-jira-validation.ymlwith the new action.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/check-jira-reference.ts |
Implements the Jira reference check using PR_BODY and JIRA_PATTERN environment variables. |
dist/check-jira-reference.js |
Committed build output for the new TypeScript script. |
actions/check-jira-reference/action.yml |
Defines the composite action wrapper around the compiled script. |
.github/workflows/pr-title-jira-validation.yml |
Calls the new composite action and passes through the configured Jira URL pattern. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+21
| - name: "Check for Jira ticket reference" | ||
| run: node '${{ github.action_path }}/../../dist/check-jira-reference.js' | ||
| shell: bash | ||
| env: | ||
| PR_BODY: ${{ inputs.pr-body }} | ||
| JIRA_PATTERN: ${{ inputs.jira-url-pattern }} |
| import * as core from '@actions/core'; | ||
| import { getRequiredEnv } from './utils'; | ||
|
|
||
| const prBody = getRequiredEnv('PR_BODY'); |
74339ff to
3b4827f
Compare
8e4cc87 to
9a0ec15
Compare
9a0ec15 to
f6ec24f
Compare
3b4827f to
e6d2b33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminates a DRY violation: the Jira ticket body check was implemented identically in two places (
pr-title-jira-validation.ymlinline grep, previously also duplicated). Extracts it into a single composite action backed by a TypeScript script.Also fixes a latent bug: the
jira-url-patterninput onpr-title-jira-validation.ymlwas defined but the job was using a hardcoded pattern instead. Now the input is correctly threaded through.Changes:
src/check-jira-reference.ts: regex check againstPR_BODYenv var,core.setFailedwith formatted erroractions/check-jira-reference/action.yml: composite action wrapping the scriptpr-title-jira-validation.yml: replace inline grep with composite action callTest plan
jira-reference-checkjob fails with formatted errorjira-url-patterninput is respected