mirror of
https://github.com/Snigdha-OS/snigdhaos-gnome-config.git
synced 2025-09-20 20:24:56 +02:00
feat(workflows): add commitizen validation check on push
This commit is contained in:
55
.github/workflows/commitizen.yml
vendored
55
.github/workflows/commitizen.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Check Commitizen
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
check-commitizen:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/$DEFAULT_BRANCH' || github.event_name == 'pull_request'
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install commitizen
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip
|
||||
pip3 install --user commitizen
|
||||
|
||||
- name: Run commitizen check
|
||||
run: |
|
||||
cz check --message "$MESSAGE" >/tmp/cz_check || true
|
||||
grep "successful" /tmp/cz_check
|
||||
|
||||
tag-to-release:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install commitizen
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git python3-pip
|
||||
pip3 install --user commitizen
|
||||
|
||||
- name: Clone repository
|
||||
run: git clone ${{ github.repository }}
|
||||
|
||||
- name: Move to project directory
|
||||
run: cd $(basename ${{ github.repository }})
|
||||
|
||||
- name: Determine changelog
|
||||
run: |
|
||||
CHANGELOG=$(cz changelog ${{ github.ref }} --dry-run | sed /^Invalid/d)
|
||||
echo "::set-env name=CHANGELOG::$CHANGELOG"
|
||||
|
||||
- name: Create release
|
||||
run: |
|
||||
release-cli create --name ${{ github.ref }} --description "${{ env.CHANGELOG }}" --tag-name ${{ github.ref }}
|
30
.github/workflows/snigdhaos-commitizen-on-push.yml
vendored
Normal file
30
.github/workflows/snigdhaos-commitizen-on-push.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Snigdha OS Commitizen Check on Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
commitizen_check:
|
||||
name: Check Commitizen Commit on Push
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Install Commitizen
|
||||
run: npm install -g commitizen
|
||||
|
||||
- name: Verify Commitizen Commit
|
||||
run: |
|
||||
if git log --format='%s' ${{ github.event.before }}..${{ github.sha }} | grep -v '^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .+'; then
|
||||
echo "Invalid commit message found. Please use Commitizen convention."
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user