Skip to content

fix(scaffolds): call wp-shared-workflows at @v1 and let .nvmrc pick Node - #89

Open
aryanjasala wants to merge 5 commits into
mainfrom
fix/scaffold-workflow-refs
Open

aryanjasala wants to merge 5 commits into
mainfrom
fix/scaffold-workflow-refs

Conversation

@aryanjasala

Copy link
Copy Markdown
Member

What this PR does

Fixes the CI scaffolds so a workflow generated with the defaults runs. ci/lint-css, ci/lint-js and ci/lint-php defaulted wsw_ref to v1.0.0/task/ci-lint-workflows, a rtCamp/wp-shared-workflows branch that no longer exists, so the generated workflow failed before any job started. They now call @v1, like the other CI scaffolds.

Closes

N/A

Changes

  • ci/lint-css, ci/lint-js, ci/lint-php: wsw_ref defaults to v1, and the templates drop the outdated "EXPERIMENTAL ... switch to @v1 once the PR is merged" header.
  • ci/test-measure: wsw_ref defaults to v1 instead of the stale release/v1.0.0 branch, and the default WordPress versions gain 7.1.
  • ci/cd-wporg: calls cd-wp-org.yml@v1 instead of the hard-coded @v1.0.0.
  • node_version in ci/build, ci/lint-css, ci/lint-js, ci/test-a11y, ci/test-js and ci/test-php defaults to empty. The templates leave node-version out when it is empty, so the shared workflow uses the project's .nvmrc (rtCamp/wp-shared-workflows v1.1.0 reads it). The old default of 22 overrode .nvmrc; --node_version still pins a version.
  • CHANGELOG entry under ### Fixed.

How I verified

  • Rendered every ci/* template with the engine's own render(), once with node_version empty and once with 24: all 16 workflows pass actionlint. The first attempt caught two templates (ci/lint-css, ci/test-a11y) where node-version was the only with: key, which would have rendered an empty with:; the whole with: block now sits inside the section there.
  • Section tags sit at line ends, as in ci/test-measure, because the renderer keeps lines that hold only a tag.
  • npx jest --ci: 82 suites, 1378 tests pass. npm run lint passes.

Reviewer notes

  • Already-scaffolded projects keep whatever ref they rendered; this only changes new output. A project with a lint workflow on the deleted branch needs @v1 by hand.

The lint-css, lint-js and lint-php scaffolds defaulted wsw_ref to the
deleted v1.0.0/task/ci-lint-workflows branch, so a workflow scaffolded
with the defaults failed at startup. test-measure defaulted to the
stale release/v1.0.0 branch and cd-wporg hard-coded @v1.0.0. All now
call @v1, and the lint templates drop the outdated EXPERIMENTAL header.

node_version defaults to empty in the six scaffolds that had 22, and
the templates leave node-version out when it is empty, so the shared
workflow reads the project's .nvmrc (wp-shared-workflows v1.1.0). An
explicit --node_version still pins a version. test-measure's default
WordPress versions gain 7.1.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 23:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The six updated CI templates lack regression coverage for optional node-version rendering, leaving the empty-with: failure unprotected.

1 open issue
What changed in this PR

Updates the CI scaffolds to use shared-workflow @v1 references and let project .nvmrc files determine Node.js versions by default. These changes affect newly generated workflows, not existing project files.

Changes:

  • Replace stale workflow references and remove obsolete experimental comments.
  • Make Node.js overrides optional across six scaffolds, omitting unused YAML inputs.
  • Add WordPress 7.1 to the test-measure matrix and document the fixes.

Paths below are relative to node-packages/wp-tooling/.

File Description
scaffolds/​ci/​test-php/​templates/​ci-test-php.yml.mustache Conditionally emits the Node.js override.
scaffolds/​ci/​test-php/​scaffold.json Defaults Node.js selection to .nvmrc.
scaffolds/​ci/​test-measure/​scaffold.json Defaults to v1 and adds WordPress 7.1.
scaffolds/​ci/​test-js/​templates/​ci-test-js.yml.mustache Makes the Node.js input conditional.
scaffolds/​ci/​test-js/​scaffold.json Removes the default Node.js pin.
scaffolds/​ci/​test-a11y/​templates/​ci-test-a11y.yml.mustache Omits with: when no override is supplied.
scaffolds/​ci/​test-a11y/​scaffold.json Defaults Node.js selection to .nvmrc.
scaffolds/​ci/​lint-php/​templates/​ci-lint-php.yml.mustache Removes obsolete experimental comments.
scaffolds/​ci/​lint-php/​scaffold.json Replaces the deleted branch default with v1.
scaffolds/​ci/​lint-js/​templates/​ci-lint-js.yml.mustache Removes stale comments and makes Node.js optional.
scaffolds/​ci/​lint-js/​scaffold.json Uses v1 and removes the Node.js pin.
scaffolds/​ci/​lint-css/​templates/​ci-lint-css.yml.mustache Removes stale comments and conditionally emits with:.
scaffolds/​ci/​lint-css/​scaffold.json Uses v1 and defaults to .nvmrc.
scaffolds/​ci/​cd-wporg/​templates/​cd-wporg.yml.mustache Calls the deployment workflow at @v1.
scaffolds/​ci/​build/​templates/​ci-build.yml.mustache Conditionally emits the Node.js override.
scaffolds/​ci/​build/​scaffold.json Removes the default Node.js pin.
CHANGELOG.md Records reference, Node.js, and matrix updates.

Review effort: Balanced

…affold

ci/cd-wporg passed inputs and secrets cd-wp-org.yml never had
(plugin-slug, svn-username, svn-password) and deployed an artifact that
nothing built, so it failed before any job ran. It now builds with
ci-build.yml, packages with wp-tooling release:zip (which honours
.distignore), unpacks with python3 (self-hosted runners have no unzip)
and deploys with cd-wp-org.yml's slug, tag, artifact-name and
WP_ORG_USERNAME/WP_ORG_PASSWORD. New inputs: wsw_ref, build_command,
assets_path.

The descriptions wp-tooling list prints drop the EXPERIMENTAL wording
and the deleted-branch advice.

A new test renders every ci/* scaffold, with and without node_version,
and checks each reusable-workflow call against a snapshot of the
wp-shared-workflows v1 workflow_call contracts: no empty with: or
secrets: block, every call at @v1, no unknown input or secret, and every
required one present. It fails on the old cd-wporg template.
Copilot AI balanced review requested due to automatic review settings November 6, 2026 00:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The artifact upload drops packaged hidden files, potentially removing access protections, while unescaped apostrophes in custom build commands can produce invalid workflow YAML.

2 open issues
1 resolved since last review

Review effort: Balanced

build-command: '{{build_command}}'
upload-artifact: true
artifact-name: wporg-package
artifact-path: dist/plugin
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-build.yml@{{wsw_ref}}
with:
install-composer-deps: true
build-command: '{{build_command}}'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

with --build_command="npm run build && cp 'readme.txt' dist/plugin/" the rendered cd-wporg.yml doesn't parse (actionlint: could not parse as YAML: did not find expected key). The default command renders fine because it has no '.

A block scalar avoids escaping altogether, since YAML takes the line as written, so ', " and # are all safe. I checked that the default and a command containing all three render valid YAML with the exact command.

Suggested change
build-command: '{{build_command}}'
build-command: >-
{{build_command}}

npx falls back to the registry when the project has no local install,
and nobody owns the unscoped wp-tooling name there. Also drop the v1
contract test and its fixture: it compared the templates with a
hand-copied snapshot, so it could not catch upstream changes, and
wp-shared-workflows already checks its own callers in CI.
@aryanjasala
aryanjasala requested a review from Adi-ty November 9, 2026 19:12
…-refs

# Conflicts:
#	node-packages/wp-tooling/CHANGELOG.md
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-build.yml@{{wsw_ref}}
with:
install-composer-deps: true
build-command: '{{build_command}}'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

with --build_command="npm run build && cp 'readme.txt' dist/plugin/" the rendered cd-wporg.yml doesn't parse (actionlint: could not parse as YAML: did not find expected key). The default command renders fine because it has no '.

A block scalar avoids escaping altogether, since YAML takes the line as written, so ', " and # are all safe. I checked that the default and a command containing all three render valid YAML with the exact command.

Suggested change
build-command: '{{build_command}}'
build-command: >-
{{build_command}}

…-refs

# Conflicts:
#	node-packages/wp-tooling/CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants