forked from synfig/synfig
-
Notifications
You must be signed in to change notification settings - Fork 3
35 lines (27 loc) · 1.24 KB
/
conventional-commits-style.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Style
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Event list: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
pull_request:
types: [opened, edited, synchronize]
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
install-and-lint-pr-title:
runs-on: ubuntu-latest
name: Conventional commits style check
steps:
- uses: actions/checkout@v4
- name: Install conventional commits linter
run: npm install --save-dev @commitlint/config-conventional @commitlint/cli
- name: Configure commitlint
run: |
echo "module.exports = {extends: ['@commitlint/config-conventional'], rules: {'subject-case': [0, 'never']}}" > commitlint.config.js
- name: Lint current pull request title
run: jq --raw-output ".pull_request.title" "$GITHUB_EVENT_PATH" | npx commitlint --verbose
# The code below is saved for future references.
# env:
# GH_TOKEN: ${{ github.token }}
# pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
# gh pr view $pr_number --json=title --jq '.title' | npx commitlint --verbose