Skip to content

Commit 83ea2b3

Browse files
tablackburnclaude
andcommitted
ci: skip template-incompatible jobs when run on un-initialized template
CI.yaml's unit-tests job runs ./build.ps1 -Task Build,Test, which fails on the template because Build's GENERATEMARKDOWN task imports {{ModuleName}}/{{ModuleName}}.psd1 and {{GUID}} can't be parsed as a valid Guid. PublishModuleToPowerShellGallery.yaml would, if it ever fired against main with placeholder content, try to publish a literal "{{ModuleName}}" module to PSGallery. Add a job-level guard to both: if: hashFiles('CHANGELOG.template.md') == '' CHANGELOG.template.md exists only pre-init (Initialize-Template.ps1 moves it onto CHANGELOG.md during init), so the marker flips on the template / off downstream. The path contains no {{Placeholder}} token, so init's substitution loop leaves the if-clause untouched in the copied workflow files — downstream repos run all jobs normally. The lint job in CI.yaml is left unchanged: Invoke-ScriptAnalyzer runs fine on the template's placeholder folder. ggshield.yaml and auto-merge-bots.yml are universal and need no guard. Companion to PR #15 (template-level CHANGELOG.md / CalVer); reuses the same marker the Manifest.tests.ps1 -Skip:$isTemplate logic uses there. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 90ecacb commit 83ea2b3

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/CI.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ jobs:
5656
unit-tests:
5757
name: Unit Tests (${{ matrix.os }})
5858
runs-on: ${{ matrix.os }}
59+
# Skip on the un-initialized template — Build's GENERATEMARKDOWN task
60+
# can't import the manifest while {{GUID}} is still a literal placeholder.
61+
# Marker: CHANGELOG.template.md exists only pre-init; Initialize-Template.ps1
62+
# moves it onto CHANGELOG.md during init, so downstream repos run the full
63+
# job. Path has no placeholder token, so init's substitution loop leaves it
64+
# intact in this file.
65+
if: hashFiles('CHANGELOG.template.md') == ''
5966
strategy:
6067
fail-fast: false
6168
matrix:

.github/workflows/PublishModuleToPowerShellGallery.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
publish:
1616
name: Publish Module
1717
runs-on: ubuntu-latest
18+
# Never publish the un-initialized template — the .psd1 still has
19+
# {{ModuleName}} and {{GUID}} placeholders. Same marker as CI.yaml.
20+
if: hashFiles('CHANGELOG.template.md') == ''
1821
steps:
1922
- name: Checkout
2023
uses: actions/checkout@v6

0 commit comments

Comments
 (0)