Skip to content

Commit 134bdd6

Browse files
fix(workflows): prevent release-please infinite loop on main branch (#470)
## Description Adds a one-line `if` guard to the Release Please job in the main workflow to prevent an infinite loop. When release-please merges its own PR, the resulting `chore(main): release` commit triggers the workflow again, which runs release-please again, creating an endless cycle. The guard skips the Release Please job when the triggering commit message starts with `chore(main): release`. - Add `if` condition to Release Please job in `.github/workflows/main.yml` to skip bot commits - Update `docs/architecture/workflows.md` with Mermaid highlight, explanatory paragraph, and table revision ## Related Issue(s) Closes #422 ## Type of Change Select all that apply: **Code & Documentation:** - [x] Bug fix (non-breaking change fixing an issue) - [ ] New feature (non-breaking change adding functionality) - [ ] Breaking change (fix or feature causing existing functionality to change) - [x] Documentation update **Infrastructure & Configuration:** - [x] GitHub Actions workflow - [ ] Linting configuration (markdown, PowerShell, etc.) - [ ] Security configuration - [ ] DevContainer configuration - [ ] Dependency update **AI Artifacts:** - [ ] Reviewed contribution with `prompt-builder` agent and addressed all feedback - [ ] Copilot instructions (`.github/instructions/*.instructions.md`) - [ ] Copilot prompt (`.github/prompts/*.prompt.md`) - [ ] Copilot agent (`.github/agents/*.agent.md`) - [ ] Copilot skill (`.github/skills/*/SKILL.md`) **Other:** - [ ] Script/automation (`.ps1`, `.sh`, `.py`) - [ ] Other (please describe): ## Testing All repository validation checks pass: - `npm run lint:yaml` — YAML linting passed - `npm run lint:md` — Markdown linting passed - `npm run lint:frontmatter` — Frontmatter validation passed - `npm run format:tables` — Table formatting verified ## Checklist ### Required Checks - [x] Documentation is updated (if applicable) - [x] Files follow existing naming conventions - [x] Changes are backwards compatible (if applicable) - [ ] Tests added for new functionality (if applicable) ### Required Automated Checks The following validation commands must pass before merging: - [x] Markdown linting: `npm run lint:md` - [ ] Spell checking: `npm run spell-check` - [x] Frontmatter validation: `npm run lint:frontmatter` - [ ] Link validation: `npm run lint:md-links` - [ ] PowerShell analysis: `npm run lint:ps` ## Security Considerations - [x] This PR does not contain any sensitive or NDA information - [ ] Any new dependencies have been reviewed for security issues - [x] Security-related scripts follow the principle of least privilege ## Additional Notes - The `if` expression requires double-quoting in YAML because the commit prefix `chore(main): release` contains a colon character - The expression uses `${{ !startsWith(...) }}` to ensure correct evaluation in GitHub Actions - Milestone: v2.3.0 (due 2026-02-11) 🔧 - Generated by Copilot
1 parent 6b84a8e commit 134bdd6

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464

6565
release-please:
6666
name: Release Please
67+
if: "${{ github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'chore(main): release') }}"
6768
needs:
6869
- spell-check
6970
- markdown-lint

docs/architecture/workflows.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Build Workflows
33
description: GitHub Actions CI/CD pipeline architecture for validation, security, and release automation
44
author: WilliamBerryiii
5-
ms.date: 2026-01-22
5+
ms.date: 2026-02-10
66
ms.topic: overview
77
---
88

@@ -133,20 +133,23 @@ flowchart LR
133133
V5[pester-tests] --> RP
134134
RP -->|release_created| PKG[extension-package-release]
135135
PKG --> ATT[attest-and-upload]
136+
style RP fill:#f9f,stroke:#333
136137
```
137138

139+
The release-please job includes a commit-message guard that skips execution when the head commit message starts with `chore(main): release`. This prevents an infinite loop where release-please-generated merge commits would re-trigger the release workflow.
140+
138141
### Main Branch Jobs
139142

140-
| Job | Purpose | Dependencies |
141-
|---------------------------|--------------------------------|------------------------------|
142-
| spell-check | Post-merge spelling validation | None |
143-
| markdown-lint | Post-merge markdown validation | None |
144-
| table-format | Post-merge table validation | None |
145-
| dependency-pinning-scan | Security pinning check | None |
146-
| pester-tests | PowerShell unit tests | None |
147-
| release-please | Automated release management | All validation jobs |
148-
| extension-package-release | Build release VSIX | release-please (conditional) |
149-
| attest-and-upload | Sign and upload VSIX | extension-package-release |
143+
| Job | Purpose | Dependencies |
144+
|---------------------------|--------------------------------|--------------------------------------------------|
145+
| spell-check | Post-merge spelling validation | None |
146+
| markdown-lint | Post-merge markdown validation | None |
147+
| table-format | Post-merge table validation | None |
148+
| dependency-pinning-scan | Security pinning check | None |
149+
| pester-tests | PowerShell unit tests | None |
150+
| release-please | Automated release management | All validation jobs (skipped on release commits) |
151+
| extension-package-release | Build release VSIX | release-please (conditional) |
152+
| attest-and-upload | Sign and upload VSIX | extension-package-release |
150153

151154
When release-please creates a release, the `extension-package-release` job builds the VSIX with the correct version, and `attest-and-upload` signs it with Sigstore attestation before uploading to the GitHub Release.
152155

0 commit comments

Comments
 (0)