Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Add discontinuation of project notice (#166) #814

Add discontinuation of project notice (#166)

Add discontinuation of project notice (#166) #814

Workflow file for this run

name: "Check Pull Request Name"
on: [pull_request, push]
jobs:
pr-name-check:
name: Check Pull Request Name
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request'
steps:
- name: Compare PR Name to the Template
uses: actions/github-script@v5
with:
script: |
const prName = context.payload.pull_request.title;
const prCreator = context.payload.pull_request.user.login;
const prNameRegExp = /^(?:\[\d+\]\s)+\w+.*/;
const skipLabel = '[skip-name]';
console.log(`Pull Request Name is ${prName}`);
// Skip the PRs with dependency updates
const dependencyBotsNames = ['dependabot', 'snyk-bot'];
const shouldSkip = prName.includes(skipLabel) || dependencyBotsNames.includes(prCreator);
if (shouldSkip) {
console.log('Skipping PR name checks.');
return;
}
if (!prNameRegExp.test(prName)) {
console.log('Template: [issue_number] ([another_issue_number] ...) Short description');
core.setFailed('Your Pull Request title does not confirm to the template.');
return;
}
console.log('Your Pull Request name confirm to the provided template.');