2021-08-03 00:18:22 +08:00
|
|
|
name: Commitlint
|
|
|
|
|
2021-08-25 23:36:11 +08:00
|
|
|
on:
|
2022-07-02 01:30:01 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'push-action/**'
|
2021-08-25 23:36:11 +08:00
|
|
|
pull_request:
|
|
|
|
types: [opened, edited, synchronize, reopened]
|
2021-08-03 00:18:22 +08:00
|
|
|
|
2022-06-17 23:58:29 +08:00
|
|
|
concurrency:
|
2023-01-19 11:22:17 +08:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
2022-06-17 23:58:29 +08:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-08-03 00:18:22 +08:00
|
|
|
jobs:
|
|
|
|
lint-commits:
|
2022-07-02 03:15:04 +08:00
|
|
|
if: github.event_name == 'pull_request'
|
2021-08-03 00:18:22 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 16:13:24 +08:00
|
|
|
- uses: actions/checkout@v4
|
2021-08-03 00:18:22 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2021-08-20 18:16:00 +08:00
|
|
|
- name: Setup Node and pnpm
|
2024-07-04 06:26:28 +00:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v5
|
2024-05-09 08:42:31 +00:00
|
|
|
with:
|
|
|
|
pnpm-version: 9
|
2021-08-03 00:18:22 +08:00
|
|
|
|
|
|
|
- name: Commitlint
|
2024-03-21 23:10:24 +08:00
|
|
|
# Credit to https://stackoverflow.com/a/67365254/12514940
|
|
|
|
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
|
2021-08-25 23:36:11 +08:00
|
|
|
|
|
|
|
- name: Commitlint on PR title
|
2022-05-05 17:00:40 +08:00
|
|
|
run: echo '${{ github.event.pull_request.title }}' | npx commitlint
|