Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions actions/pr-jira-ticket/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR Jira Ticket Check
description: Validates that a Jira ticket (e.g. ED-1234) exists in the PR title, branch name, or body.

runs:
using: composite
steps:
- name: Check for Jira ticket
uses: actions/github-script@v7
with:
script: |
const pattern = /[A-Z]{2,10}-\d+/;

const title = context.payload.pull_request?.title || '';
const branch = context.payload.pull_request?.head?.ref || '';
const body = context.payload.pull_request?.body || '';

const sources = { title, branch, body };
const found = Object.entries(sources).find(([, value]) => pattern.test(value));

if (found) {
const [source, value] = found;
const ticket = value.match(pattern)[0];
core.info(`Found Jira ticket ${ticket} in PR ${source}`);
} else {
core.setFailed('No Jira ticket found in PR title, branch name, or body');
}
Loading