Skip to content

Commit 1bb70dc

Browse files
author
Venkata Subramani Renduchintala
committed
ci: skip pipeline for documentation-only changes
Restrict the validate workflow so it does not build for docs work: - on.push uses branches-ignore: "docs/**" — pushes to docs branches never trigger the workflow. - the job `if` skips PRs opened from a docs/* branch (github.head_ref) and pushes whose tip commit is docs:/docs(scope):. The previous check only matched bare docs:/chore: and missed the scoped conventional-commit form (e.g. docs(readme):), so docs PRs still built.
1 parent 70b7b21 commit 1bb70dc

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/validate.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@ name: Validate Neovim Config
22

33
on:
44
push:
5-
branches: ["**"]
5+
# Documentation branches only ever carry docs changes — never build them.
6+
branches-ignore:
7+
- "docs/**"
68
pull_request:
79
branches: [main]
810

911
jobs:
1012
validate:
1113
name: Build & validate Neovim
1214
runs-on: ubuntu-latest
13-
# Skip docs: and chore: commits on push; always run on pull requests
14-
if: |
15-
github.event_name == 'pull_request' ||
16-
(
17-
!startsWith(github.event.head_commit.message, 'docs:') &&
18-
!startsWith(github.event.head_commit.message, 'chore:')
19-
)
15+
# Do not run for documentation-only work:
16+
# - PRs opened from a docs/* branch (github.head_ref)
17+
# - pushes whose tip commit is a docs:/chore: (or scoped) commit
18+
# On pull_request events head_commit is null, so only the head_ref check
19+
# applies there; on push events head_ref is empty, so only the message
20+
# checks apply. Pushes to docs/** never reach here (filtered by on.push).
21+
if: >-
22+
!startsWith(github.head_ref, 'docs/') &&
23+
!startsWith(github.event.head_commit.message, 'docs:') &&
24+
!startsWith(github.event.head_commit.message, 'docs(') &&
25+
!startsWith(github.event.head_commit.message, 'chore:') &&
26+
!startsWith(github.event.head_commit.message, 'chore(')
2027
2128
steps:
2229
- name: Checkout

0 commit comments

Comments
 (0)