diff --git a/.gitea/scoped_workflows/commits-validation.yaml b/.gitea/scoped_workflows/commits-validation.yaml index 462d0aa..6c16dce 100644 --- a/.gitea/scoped_workflows/commits-validation.yaml +++ b/.gitea/scoped_workflows/commits-validation.yaml @@ -106,4 +106,13 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha }} COMMITLINT_CONFIG: ${{ steps.commitlint-config.outputs.config }} run: | - "$COMMITLINT_BIN" --from "$BASE_SHA" --to "$HEAD_SHA" --verbose --config "$COMMITLINT_CONFIG" + set -euo pipefail + mapfile -t shas < <(git rev-list --no-merges "$BASE_SHA...$HEAD_SHA") + if [[ ${#shas[@]} -eq 0 ]]; then + echo "No non-merge commits to lint" + exit 0 + fi + for sha in "${shas[@]}"; do + echo "Linting ${sha}" + git log -1 --format=%B "$sha" | "$COMMITLINT_BIN" --verbose --config "$COMMITLINT_CONFIG" + done