Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: PR Validation [auto]
name: Commit Validation [auto]

permissions:
contents: read

on:
pull_request:
branches: [main, 'release/**']
on: push

concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
validate-commits:
Expand All @@ -18,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.sha }}

- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # Pinned commit hash for @v4

Expand All @@ -44,17 +42,17 @@ jobs:

- name: Validate commits
run: |
BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
BASE=$(git merge-base ${{ github.sha }} ${{ github.sha }})
pnpx commitlint \
--from "$BASE" \
--to ${{ github.event.pull_request.head.sha }}
--to ${{ github.sha }}
Comment on lines 44 to +48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Lint range collapses to a single commit on push

Because BASE is computed as git merge-base ${{ github.sha }} ${{ github.sha }}, the base always equals the current SHA, so --from and --to are identical. On a push that contains multiple commits (e.g., after a rebase or when pushing a series of local commits), this configuration only lints the tip commit and skips earlier commits, allowing invalid commit messages through. If the intent is to validate all commits introduced by the push, use the previous head (e.g., github.event.before) as the start of the range.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 That's legit. Marking this as do-not-merge for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

This compares github.sha with itself, so git merge-base will return the same commit.


run-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.sha }}

- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # Pinned commit hash for @v4

Expand Down Expand Up @@ -96,7 +94,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.sha }}

- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # Pinned commit hash for @v4

Expand Down Expand Up @@ -161,7 +159,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.sha }}

- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # Pinned commit hash for @v4

Expand Down
6 changes: 3 additions & 3 deletions cicd.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ main (next) → stable (latest) → X.x (maintenance)

### Core Workflows

#### 1. PR Validation (`pr-validation.yml`)
#### 1. Commit Validation (`commit-validation.yml`)

**Triggers**: All pull requests
**Triggers**: All pushes

**Checks**:

Expand All @@ -44,7 +44,7 @@ main (next) → stable (latest) → X.x (maintenance)
- Visual regression tests
- E2E tests (main branch only)

**Required to pass before merge**.
**Required to pass before PR merge**.

#### 2. Release (`release.yml`)

Expand Down
Loading