mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-01-26 11:14:04 +00:00
41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: Commit Messages
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
commitlint:
|
|
name: Validate Commit Messages
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install commitlint
|
|
run: |
|
|
npm install --save-dev @commitlint/cli@19.6.1 @commitlint/config-conventional@19.6.0
|
|
|
|
- name: Validate current commit (for single commits)
|
|
if: github.event_name == 'push'
|
|
run: npx commitlint --from HEAD~1 --to HEAD --verbose
|
|
|
|
- name: Validate PR commits
|
|
if: github.event_name == 'pull_request'
|
|
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
|