Skip to content

feat(ci): forward wp-ci inputs to leaves and resolve Node from .nvmrc - #47

Open
Adi-ty wants to merge 2 commits into
mainfrom
feat/wp-ci-input-passthrough
Open

Adi-ty wants to merge 2 commits into
mainfrom
feat/wp-ci-input-passthrough

Conversation

@Adi-ty

@Adi-ty Adi-ty commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Lets wp-ci.yml callers configure every job it fans out to (Node/PHP versions, Composer flags, the *-command inputs), and makes every leaf honor .nvmrc instead of forcing Node 22.

Closes

N/A

Changes

  • wp-ci.yml now forwards 16 inputs to the leaves: node-version, php-version, composer-flags, build-composer-flags, install-composer-deps, build-command, lint-css-command, lint-js-command, phpcs-command, phpstan-command, test-js-command, test-js-cache, test-php-command, a11y-command.
  • Leaves resolve Node from node-version, else .nvmrc in working-dir, else the repo root's .nvmrc, else 22.
  • Same resolution added to cd-built-branch.yml, per target.
  • String input defaults moved from the workflow_call block to a fallback at the step, because GitHub forwards an empty string instead of the callee's default.
  • Existing callers behave the same; no input renamed or removed, so it is safe for consumers pinned at v1.
  • ci-detect-changes and version-monitor keep a fixed Node version; they run wp-tooling, not project code.
  • Documented both conventions in AGENTS.md and README.md.

How I verified

  • yamllint, actionlint and bin/check-workflows.sh pass.

Acceptance criteria

Code quality

  • Lint — zero errors
  • Static analysis — zero errors
  • Tests pass

Housekeeping

  • CHANGELOG.md entry under the current version heading
  • examples/<workflow>.yml added or updated to match any input change
  • yamllint, actionlint and bin/check-workflows.sh pass locally

@Adi-ty
Adi-ty marked this pull request as ready for review October 5, 2026 17:05
@Adi-ty
Adi-ty requested review from AnuragVasanwala and aryanjasala and a balanced review from Copilot October 5, 2026 17:05

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 4 High severity · 5 Medium severity

Open (9)
What changed in this PR

This PR enhances the reusable CI/CD workflows so callers can override leaf-job settings (notably Node/PHP versions and command inputs) while making Node resolution respect project .nvmrc files instead of always forcing Node 22.

Changes:

  • Forward additional inputs from wp-ci.yml into leaf workflows (Node/PHP versions, Composer flags, per-job *-command inputs).
  • Add consistent Node resolution logic across “leaf” workflows: node-version → .nvmrc in working-dir → repo root .nvmrc → Node 22.
  • Update docs (README/AGENTS) to describe the forwarding behavior and GitHub’s empty-string default behavior.
File Description
README.md Documents Node resolution and forwarded leaf inputs.
AGENTS.md Captures conventions for forwarding inputs and Node selection behavior.
.github/​workflows/​wp-ci.yml Adds and forwards many new inputs to leaf workflows.
.github/​workflows/​ci-test-php.yml Uses .nvmrc-aware Node resolution and step-level string defaults.
.github/​workflows/​ci-test-js.yml Uses .nvmrc-aware Node resolution and step-level string defaults.
.github/​workflows/​ci-test-build-artifact.yml Uses .nvmrc-aware Node resolution; step-level defaults for PHP version.
.github/​workflows/​ci-test-a11y.yml Uses .nvmrc-aware Node resolution and step-level command defaults.
.github/​workflows/​ci-lint-php.yml Moves string defaults to runtime fallbacks (PHP/Composer/PHPCS/PHPStan).
.github/​workflows/​ci-lint-js.yml Adds .nvmrc Node resolution; changes “lint changed files” behavior.
.github/​workflows/​ci-lint-css.yml Adds .nvmrc Node resolution; changes “lint changed files” behavior.
.github/​workflows/​ci-build.yml Adds .nvmrc Node resolution; moves PHP/Composer defaults to runtime fallbacks.
.github/​workflows/​cd-built-branch.yml Adds per-target .nvmrc support via node-version-file in the matrix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci-lint-css.yml
Comment thread .github/workflows/ci-lint-css.yml
Comment thread .github/workflows/ci-lint-js.yml
Comment thread .github/workflows/ci-lint-js.yml
Comment thread .github/workflows/cd-built-branch.yml Outdated
Comment on lines +234 to +235
if [ -z "$node_version" ]; then
if [ -s "$dir/.nvmrc" ]; then node_version_file="${dir%/}/.nvmrc"
--arg name "$name" --arg dir "$dir" \
--arg composer "$composer" --arg node "$node" \
--arg php "$php_version" --arg nodever "$node_version" \
--arg php "$php_version" --arg nodever "$node_version" --arg nodefile "$node_version_file" \
--arg pp "$publish_abs" --arg vp "$verify_abs" \
'{name:$name, dir:$dir, composer:$composer, node:$node,
"php-version":$php, "node-version":$nodever,
"php-version":$php, "node-version":$nodever, "node-version-file":$nodefile,
Comment on lines 341 to +342
node-version: ${{ matrix.node-version }}
node-version-file: ${{ matrix.node-version-file }}
Comment on lines +44 to +62
# Node version: the input, else .nvmrc (working-dir, then repo root), else 22.
- name: Resolve Node.js version
id: node
shell: bash
env:
NODE_VERSION: ${{ inputs.node-version }}
WORKING_DIR: ${{ inputs.working-dir }}
run: |
set -euo pipefail
# setup-node reads the file path from the repo root.
if [ -n "$NODE_VERSION" ]; then
echo "version=$NODE_VERSION" >> "$GITHUB_OUTPUT"
elif [ -s .nvmrc ]; then
echo "file=$WORKING_DIR/.nvmrc" >> "$GITHUB_OUTPUT"
elif [ -s "$GITHUB_WORKSPACE/.nvmrc" ]; then
echo "file=.nvmrc" >> "$GITHUB_OUTPUT"
else
echo "version=22" >> "$GITHUB_OUTPUT"
fi
Copilot AI balanced review requested due to automatic review settings October 6, 2026 05:29

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.

Comment on lines +44 to +62
# Node version: the input, else .nvmrc (working-dir, then repo root), else 22.
- name: Resolve Node.js version
id: node
shell: bash
env:
NODE_VERSION: ${{ inputs.node-version }}
WORKING_DIR: ${{ inputs.working-dir }}
run: |
set -euo pipefail
# setup-node reads the file path from the repo root.
if [ -n "$NODE_VERSION" ]; then
echo "version=$NODE_VERSION" >> "$GITHUB_OUTPUT"
elif [ -s .nvmrc ]; then
echo "file=$WORKING_DIR/.nvmrc" >> "$GITHUB_OUTPUT"
elif [ -s "$GITHUB_WORKSPACE/.nvmrc" ]; then
echo "file=.nvmrc" >> "$GITHUB_OUTPUT"
else
echo "version=22" >> "$GITHUB_OUTPUT"
fi
Comment on lines +71 to +90
# Node version: the input, else .nvmrc (working-dir, then repo root), else 22.
- name: Resolve Node.js version
id: node
if: ${{ inputs.install-node-deps }}
shell: bash
env:
NODE_VERSION: ${{ inputs.node-version }}
WORKING_DIR: ${{ inputs.working-dir }}
run: |
set -euo pipefail
# setup-node reads the file path from the repo root.
if [ -n "$NODE_VERSION" ]; then
echo "version=$NODE_VERSION" >> "$GITHUB_OUTPUT"
elif [ -s .nvmrc ]; then
echo "file=$WORKING_DIR/.nvmrc" >> "$GITHUB_OUTPUT"
elif [ -s "$GITHUB_WORKSPACE/.nvmrc" ]; then
echo "file=.nvmrc" >> "$GITHUB_OUTPUT"
else
echo "version=22" >> "$GITHUB_OUTPUT"
fi
@Adi-ty
Adi-ty added this pull request to stack #50 October 8, 2026 05:46
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.

2 participants