chore: sync files with stordco/common-config-elixir #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. | |
name: PR | |
on: | |
merge_group: | |
pull_request: | |
types: | |
- edited | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
Title: | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const title = context.payload?.pull_request?.title; | |
if (typeof title !== 'string') { | |
core.info("Pull request data not in payload. Skipping PR title check."); | |
return; | |
} | |
const REGEX = /^(feat!|fix!|hotfix!|fix|feat|chore|hotfix|(fix|feat|chore|hotfix)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*/; | |
if (!REGEX.test(title)) { | |
core.setFailed("Pull request title does not follow conventional commits"); | |
console.log(` | |
Pull Request title "${title}" does not follow our [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) naming scheme. | |
Please try renaming the PR to match one of these examples: | |
chore: a small insignificant change | |
fix: [JIRA-1234] fix an existing feature | |
feat: [JIRA-1234] a new feature to release | |
feat!: a breaking change | |
hotfix: needed in production immediately | |
Adding ! (i.e. \`feat!:\`) represents a breaking change and will result in a SemVer major release. | |
Starting a commit with \`hotfix\` will result in a seperate hotfix release PR. | |
`.trim()); | |
} |