ci: only run commitlint on github PRs

The `commitlint` script disrupts our release workflow if failed
on push event. We also don't need it on push because once pushed,
git commit history can't be amended.
This commit is contained in:
Taimoor Zaeem
2025-06-18 17:03:04 +00:00
committed by Wolfgang Walther
parent 63a492291a
commit 330df05891
+3 -4
View File
@@ -32,6 +32,7 @@ jobs:
run: postgrest-style-check run: postgrest-style-check
commit: commit:
if: github.event_name != 'push' # we don't run this on a push, a failure on push disrupts the release workflow
name: Commit name: Commit
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
@@ -46,9 +47,7 @@ jobs:
- name: Run commitlint (check locally with `nix-shell --run postgrest-commitlint`) - name: Run commitlint (check locally with `nix-shell --run postgrest-commitlint`)
run: | run: |
# Fetch target branch explicitly # Fetch target branch explicitly
# For PRs event -> github.base_ref git fetch origin ${{ github.base_ref }}
# For push event -> github.ref_name
git fetch origin ${{ github.base_ref || github.ref_name }}
# Run commitlint # Run commitlint
postgrest-commitlint --from origin/${{ github.base_ref || github.ref_name }} --to HEAD postgrest-commitlint --from origin/${{ github.base_ref }} --to HEAD