Skip to content

ci: Create web-kit-pull-request.yml #132

ci: Create web-kit-pull-request.yml

ci: Create web-kit-pull-request.yml #132

name: "Branch Name PR Check"
on:
workflow_call:
pull_request:
types: [opened, reopened, synchronize, edited]
jobs:
pr-branch-name-check:
name: "Check PR for semantic branch name"
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: "Set PR branch validity"
id: is-semantic
if: >
startsWith(github.event.pull_request.head.ref, 'feat/') ||
startsWith(github.event.pull_request.head.ref, 'fix/') ||
startsWith(github.event.pull_request.head.ref, 'perf/') ||
startsWith(github.event.pull_request.head.ref, 'docs/') ||
startsWith(github.event.pull_request.head.ref, 'test/') ||
startsWith(github.event.pull_request.head.ref, 'refactor/') ||
startsWith(github.event.pull_request.head.ref, 'style/') ||
startsWith(github.event.pull_request.head.ref, 'build/') ||
startsWith(github.event.pull_request.head.ref, 'ci/') ||
startsWith(github.event.pull_request.head.ref, 'chore/') ||
startsWith(github.event.pull_request.head.ref, 'revert/') ||
startsWith(github.event.pull_request.head.ref, 'dependabot/')
run: |
OUTPUT=true
echo "isSemantic=$OUTPUT" >> $GITHUB_OUTPUT
- name: "echo isSemantic"
run: |
echo ${{ steps.is-semantic.outputs.isSemantic }}
- name: "Branch name is valid"
if: ${{steps.is-semantic.outputs.isSemantic == 'true'}}
run: |
echo 'Pull request branch name is valid.'
echo ${{ steps.is-semantic.outputs.isSemantic }}
- name: "Branch name is invalid"
if: ${{ steps.is-semantic.outputs.isSemantic != 'true'}}
run: |
echo ${{ steps.is-semantic.outputs.isSemantic }}
echo 'Pull request branch name, ${{github.event.pull_request.head.ref}} is not valid.'
echo 'branch name must start with one of:'
echo ' build/,'
echo ' chore/,'
echo ' ci/,'
echo ' docs/,'
echo ' feat/,'
echo ' fix/,'
echo ' perf/,'
echo ' refactor/,'
echo ' revert/'
echo ' style/,'
echo ' test/,'
exit 1