Skip to content

FDN-2371: Upgrade sbt to version 1.10.0 #34

FDN-2371: Upgrade sbt to version 1.10.0

FDN-2371: Upgrade sbt to version 1.10.0 #34

Workflow file for this run

name: "PR Title and Description Check"
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
check-title-and-description:
runs-on: ubuntu-latest
steps:
- name: Check PR title and description
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const payload = context.payload;
const prTitle = payload.pull_request.title;
const prDescription = payload.pull_request.body;
// The pattern for JIRA ticket format
const jiraPattern = /\b[A-Z]+-\d+\b|breakglass/gi;
// Check PR title
const hasJiraTitle = jiraPattern.test(prTitle);
console.log(`PR title: ${hasJiraTitle ? 'Valid' : 'Invalid'}`);
// Check PR description
const hasJiraDescription = prDescription ? prDescription.match(jiraPattern) : false;
console.log(`PR description: ${hasJiraDescription ? 'Valid' : 'Invalid'}`);
if (hasJiraTitle || hasJiraDescription) {
console.log('PR title or description format is correct.');
} else {
const errorMessage = [];
errorMessage.push('The PR title and description do not include a valid JIRA ticket!');
console.log(errorMessage.join('\n'));
core.setFailed(errorMessage.join('\n'));
}