Skip to content

Commit c13021a

Browse files
authored
FDN-4581 Centralize github workflow definitions (#36)
1 parent feab909 commit c13021a

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

.github/workflows/pr-validator.yml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,7 @@ name: "PR Title and Description Check"
22
on:
33
pull_request:
44
types: [opened, edited, synchronize]
5-
65
jobs:
7-
check-title-and-description:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Check PR title and description
11-
uses: actions/github-script@v4
12-
with:
13-
github-token: ${{ secrets.GITHUB_TOKEN }}
14-
script: |
15-
const payload = context.payload;
16-
const prTitle = payload.pull_request.title;
17-
18-
// The pattern for JIRA ticket format
19-
// Must be at the beginning of the PR title
20-
// Prefix must be at least 3 uppercase letters
21-
// Excludes tickets with only zeros after the prefix (e.g., XXX-000, XXX-0000)
22-
// Number must be 3 to 6 digits
23-
const jiraPattern = /^[A-Z]{3,}-(?!0+\b)\d{3,6}\b/;
24-
25-
// Check PR title
26-
const hasJiraTitle = jiraPattern.test(prTitle);
27-
console.log(`PR title: ${hasJiraTitle ? 'Valid' : 'Invalid'}`);
28-
29-
if (hasJiraTitle) {
30-
console.log('PR title format is correct.');
31-
} else {
32-
const errorMessage = 'The PR title must start with a valid JIRA ticket with 3-6 digits (e.g., ABC-123, DATAPLATFORM-12345). The ticket must be at the start, use at least 3 uppercase letters, and the number must not be all zeros.';
33-
console.log(errorMessage);
6+
validate:
7+
uses: flowcommerce/code-steward/.github/workflows/pr-validator.yml@main
348

35-
core.setFailed(errorMessage);
36-
}

0 commit comments

Comments
 (0)