mirror of
https://github.com/sotashimozono/obsidian-remote-ssh.git
synced 2026-07-22 06:52:07 +00:00
PR #298 (the sync workflow's auto-PR main → next) couldn't merge: Couldn't update 'main': Changes must be made through a pull request. Required status check 'version-check' is expected. Both `version-check.yml` and `commitlint.yml` had a job-level `if: github.head_ref != 'main'` to skip on sync PRs. GitHub treats a job-level skip as 'check-run not created' — branch protection then sees a required check as 'expected but missing' and refuses the merge. Fix: keep the JOB always running so a check-run is produced, and move the conditional to the STEP level. On a sync PR, the only step that runs is a Skip note that prints why; the job still reports success and branch protection unblocks. Bump: 1.0.45-beta.0 → 1.0.45-beta.1.
70 lines
2.4 KiB
YAML
70 lines
2.4 KiB
YAML
name: Commitlint
|
||
|
||
# Phase D-α — enforce Conventional Commits on every PR.
|
||
#
|
||
# All PRs in this repo already follow the format
|
||
# (`type(scope): subject`) by hand convention; this workflow turns
|
||
# that convention into a hard gate so a slip-up doesn't sneak past
|
||
# review. Lint runs against every commit in the PR, NOT just the
|
||
# squash-merge title — so a typo in commit #3 of a 5-commit PR
|
||
# fails fast.
|
||
#
|
||
# Why on PRs only (not on push to main): main is squash-merged from
|
||
# PRs whose commits already passed; running on every push to main
|
||
# would be redundant and would re-fire on the merge commit which
|
||
# has its own (also Conventional) format.
|
||
|
||
on:
|
||
pull_request:
|
||
branches: [main, next]
|
||
|
||
concurrency:
|
||
group: commitlint-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
permissions:
|
||
contents: read
|
||
pull-requests: read
|
||
|
||
jobs:
|
||
lint:
|
||
name: Lint commit messages
|
||
runs-on: ubuntu-latest
|
||
# NOTE: the JOB always runs so it produces a `success` check-run.
|
||
# Branch protection lists this as a required check, and a job-level
|
||
# `if:` would cause GitHub to omit the check entirely ("expected but
|
||
# missing" → merge blocked). We instead skip at the STEP level for
|
||
# sync PRs (head_ref=main): no real work happens, but the empty job
|
||
# still reports green.
|
||
steps:
|
||
- name: Skip note (sync PRs only)
|
||
if: github.head_ref == 'main'
|
||
run: echo "Sync PR (main → next) — commitlint skipped (commit range includes autogenerated merge titles + already-linted promotion content)."
|
||
|
||
- if: github.head_ref != 'main'
|
||
uses: actions/checkout@v6
|
||
with:
|
||
# Need full history so commitlint can walk the PR's
|
||
# commit range (base..head). Fetch-depth: 0 is overkill
|
||
# but cheap on a 200-commit repo and won't bite us when
|
||
# PRs grow longer.
|
||
fetch-depth: 0
|
||
|
||
- if: github.head_ref != 'main'
|
||
uses: actions/setup-node@v6
|
||
with:
|
||
node-version: '20'
|
||
|
||
- name: Install commitlint
|
||
if: github.head_ref != 'main'
|
||
run: |
|
||
npm install --no-save --no-audit --no-fund \
|
||
@commitlint/cli@^20 \
|
||
@commitlint/config-conventional@^20
|
||
|
||
- name: Lint PR commit range
|
||
if: github.head_ref != 'main'
|
||
env:
|
||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||
run: npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose
|