Skip to content

Commit d5f60fa

Browse files
committed
chore: change to action
1 parent c6a8a74 commit d5f60fa

2 files changed

Lines changed: 26 additions & 36 deletions

File tree

.github/workflows/pr-jira-ticket.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

actions/pr-jira-ticket/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PR Jira Ticket Check
2+
description: Validates that a Jira ticket (e.g. ED-1234) exists in the PR title, branch name, or body.
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Check for Jira ticket
8+
uses: actions/github-script@v7
9+
with:
10+
script: |
11+
const pattern = /[A-Z]{2,10}-\d+/;
12+
13+
const title = context.payload.pull_request?.title || '';
14+
const branch = context.payload.pull_request?.head?.ref || '';
15+
const body = context.payload.pull_request?.body || '';
16+
17+
const sources = { title, branch, body };
18+
const found = Object.entries(sources).find(([, value]) => pattern.test(value));
19+
20+
if (found) {
21+
const [source, value] = found;
22+
const ticket = value.match(pattern)[0];
23+
core.info(`Found Jira ticket ${ticket} in PR ${source}`);
24+
} else {
25+
core.setFailed('No Jira ticket found in PR title, branch name, or body');
26+
}

0 commit comments

Comments
 (0)