Skip to content

chore: continuous integration for the PHP toolchain - #4

Merged
YonatanVol merged 1 commit into
mainfrom
chore/04-ci-workflow
Aug 5, 2026
Merged

chore: continuous integration for the PHP toolchain#4
YonatanVol merged 1 commit into
mainfrom
chore/04-ci-workflow

Conversation

@YonatanVol

@YonatanVol YonatanVol commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Issue #4 — CI. This PR verifies itself: the workflow runs against this very branch, so the Actions result below is the acceptance evidence.

What changed

  • .github/workflows/ci.yml — three jobs: php (matrix), secrets, verify
  • .github/dependabot.yml — weekly Composer + GitHub Actions updates

Jobs

Job Runs
php PHPCS → PHPStan → HPOS sniff self-test → PHPUnit, on PHP 8.2 and 8.3
secrets gitleaks over full history
verify Aggregates the above into one check

Design decisions worth reviewing

Matrix is 8.2 + 8.3, fail-fast: false. 8.2 is the supported floor and what Composer resolves against; 8.3 is local and production. A break on either is a real break, so knowing both results beats finishing thirty seconds sooner.

The verify job exists for branch protection. Requiring matrix legs by name means protection silently stops covering any leg added later — a gap nobody notices until it matters. One aggregating check avoids that. Issue #5 will require verify and nothing else.

gitleaks uses fetch-depth: 0. On a public repo, a secret removed in a later commit is still public. Scanning only the tip would miss precisely the case that matters.

No npm job, and no npm in Dependabot. There is no JavaScript toolchain yet — registry.npmjs.org is unreachable from the dev environment (see PR #3). Adding the ecosystem before a manifest exists produces noise, not updates. Both get added when the toolchain lands.

Acceptance criteria (master plan §20, Issue #4)

  • CI green on a clean PR — this PR
  • CI red on a PR with a deliberate lint error, and merge blocked — see below

The second half needs branch protection (#5) to observe "merge blocked". I can demonstrate the red half here on request by pushing a deliberate violation, or fold it into #5 where the blocking behaviour is actually testable.

Notes / limitations

  • Mobile / RTL / accessibility evidence: N/A — no UI.
  • Not yet enforced. Until TEMP: prove CI catches an HPOS violation #5 configures branch protection, CI is advisory — it reports but cannot block. That is the next Issue.
  • ramsey/composer-install@v3 caches dependencies between runs.
  • permissions: contents: read at workflow level; gitleaks gets only the default token.

Rollback

git revert <merge-commit>. Removes CI; no runtime impact.

Summary by CodeRabbit

  • Chores

    • Added automated dependency update configuration for Composer and GitHub Actions.
    • Added continuous integration checks for PHP compatibility, code quality, security scanning, and PHPUnit tests.
    • Added an aggregated verification step to ensure all required checks pass.
  • Documentation

    • Updated the unreleased changelog with CI, dependency update, branch protection, and deployment workflow details.

Runs the same gates CI will enforce on every pull request, so "it passed
locally" stops being the only evidence.

Jobs:
- php: PHPCS, PHPStan, HPOS sniff self-test and PHPUnit, on a 8.2/8.3 matrix
- secrets: gitleaks over full history
- verify: aggregates the above into one check

Matrix rationale. 8.2 is the supported floor and what Composer resolves
against; 8.3 is what local development and the production host run. A break on
either is a real break, so fail-fast is off — knowing both results is worth
more than finishing thirty seconds sooner.

The verify job exists so branch protection has a single stable check to
require. Requiring matrix legs by name means protection silently stops covering
any leg added later, which is the kind of gap nobody notices until it matters.

gitleaks checks out full history rather than the tip. On a public repository a
secret removed in a later commit is still public, so scanning only the tip
would miss exactly the case that matters.

Dependabot covers Composer and GitHub Actions weekly. The npm ecosystem is
deliberately absent: there is no JavaScript toolchain yet, because
registry.npmjs.org is unreachable from the development environment. Adding the
ecosystem before the manifest exists would produce noise, not updates.

Refs #4

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds a GitHub Actions CI workflow, full-history gitleaks scanning, aggregate verification, weekly Composer and GitHub Actions Dependabot updates, and related changelog entries.

Changes

CI and dependency automation

Layer / File(s) Summary
CI validation and verification pipeline
.github/workflows/ci.yml, CHANGELOG.md
The workflow runs PHP 8.2 and 8.3 checks, gitleaks scanning, and a required verify job. The changelog records CI and branch protection details.
Dependency update configuration
.github/dependabot.yml, CHANGELOG.md
Dependabot schedules weekly Composer and GitHub Actions updates with limits, labels, and commit-message settings. The changelog notes that npm updates remain unconfigured.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant PHPMatrix
  participant Gitleaks
  participant Verify
  GitHubActions->>PHPMatrix: Run PHP 8.2 and 8.3 checks
  GitHubActions->>Gitleaks: Scan full repository history
  PHPMatrix-->>Verify: Report PHP job result
  Gitleaks-->>Verify: Report secret-scan result
  Verify-->>GitHubActions: Fail unless both jobs succeed
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the pull request's primary change: adding continuous integration for the PHP toolchain.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/04-ci-workflow

Comment @coderabbitai help to get the list of available commands.

@YonatanVol

Copy link
Copy Markdown
Owner Author

Acceptance criteria verified

Both halves now confirmed with real Actions runs.

Positive — CI green on a clean PR (run 31023640492):

Job Result
PHP 8.2 ✅ PHPCS → PHPStan → sniff self-test → PHPUnit
PHP 8.3 ✅ same
Secret scan ✅ gitleaks, full history
All checks passed

Negative — CI red on a violation (run 31023761248, throwaway branch, now deleted):

A file calling get_post_meta( $order_id, ... ) produced:

FOUND 1 ERROR AFFECTING 1 LINE
... was "$order_id". (ElectricChic.HPOS.NoDirectOrderMeta.PostMeta)

Failed on both PHP legs, and the aggregate All checks passed job failed with them — confirming the single check that #5 will require actually gates.

The custom sniff works in a clean CI environment, not just locally. Throwaway branch and PR #5 are closed and deleted.

Remaining: "merge is blocked" still needs branch protection (#5). CI currently reports but cannot block.

@YonatanVol
YonatanVol merged commit 882bb71 into main Aug 5, 2026
4 of 5 checks passed
@YonatanVol
YonatanVol deleted the chore/04-ci-workflow branch August 5, 2026 16:09

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 32-35: Update the GitHub Actions versions in the CI workflow:
replace actions/checkout@v4 with actions/checkout@v6 and
gitleaks/gitleaks-action@v2 with gitleaks/gitleaks-action@v3, leaving the
surrounding workflow configuration unchanged.

In `@CHANGELOG.md`:
- Line 91: Update the changelog entry for Issues `#05` and `#06` to state that
branch protection is deferred or will be configured, rather than claiming it is
already configured; keep the deploy-workflow status accurate.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f35333b-41da-422e-ae60-66833f99bcd5

📥 Commits

Reviewing files that changed from the base of the PR and between 66c51b3 and 4519933.

📒 Files selected for processing (3)
  • .github/dependabot.yml
  • .github/workflows/ci.yml
  • CHANGELOG.md

Comment thread .github/workflows/ci.yml
Comment on lines +32 to +35
uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

for action in actions/checkout gitleaks/gitleaks-action; do
  ref=$([ "$action" = "actions/checkout" ] && printf 'v4' || printf 'v2')
  curl -fsSL "https://raw.githubusercontent.com/${action}/${ref}/action.yml" |
    grep -E '^[[:space:]]*using:[[:space:]]*["'\'']?node'
done

Repository: YonatanVol/ElectricChic

Length of output: 196


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- workflow ---'
cat -n .github/workflows/ci.yml

printf '%s\n' '--- action metadata ---'
for spec in \
  actions/checkout:v4 actions/checkout:v5 actions/checkout:v6 \
  gitleaks/gitleaks-action:v2 gitleaks/gitleaks-action:v3; do
  repo=${spec%:*}
  ref=${spec#*:}
  printf '\n[%s@%s]\n' "$repo" "$ref"
  if curl -fsSL "https://raw.githubusercontent.com/$repo/$ref/action.yml" |
    grep -E '^[[:space:]]*using:[[:space:]]*["'\'']?node|^[[:space:]]*name:|^[[:space:]]*runs:'; then
    :
  else
    printf 'metadata unavailable\n'
  fi
done

printf '%s\n' '--- tag refs ---'
for repo in actions/checkout gitleaks/gitleaks-action; do
  printf '\n[%s]\n' "$repo"
  curl -fsSL "https://api.github.com/repos/$repo/git/refs/tags" |
    jq -r '.[].ref' | grep -E '/v[0-9]+(\.[0-9]+){0,2}$' | tail -20
done

Repository: YonatanVol/ElectricChic

Length of output: 3814


🌐 Web query:

GitHub Actions Node 20 deprecation September 16 2026 Node 24 actions deadline

💡 Result:

As of August 5, 2026, GitHub is actively managing the transition from Node.js 20 to Node.js 24 for GitHub Actions runners [1]. The key dates and status of this migration are as follows: - Node.js 20 Default Transition: GitHub successfully updated the runner default to Node.js 24 on June 16, 2026 [1][2]. - Node.js 20 Removal: Node.js 20 is scheduled to be fully removed from GitHub Actions runners in the fall of 2026 [1]. While some community discussions and pull requests have referenced mid-September dates [3], the official timeline maintains a "fall of 2026" goal for the complete removal of Node.js 20 [1]. Migrating to Node.js 24: Actions maintainers are advised to update their actions to support Node.js 24 [1]. Users can check if their workflows are using deprecated Node.js 20 actions through warning annotations provided at the end of job execution [4]. Temporary Opt-Out: For workflows that still require Node.js 20, users can temporarily opt out of the Node.js 24 default by setting the environment variable ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true [1][5]. This is an interim measure and will cease to function once Node.js 20 is completely removed from the runners later this fall [1].

Citations:


🌐 Web query:

actions/checkout v6 release Node 24 gitleaks/gitleaks-action v3 release

💡 Result:

Both actions/checkout v6 and gitleaks/gitleaks-action v3 were released to support the transition to Node 24 in GitHub Actions [1][2][3]. actions/checkout v6 Released on November 20, 2025 [1][4], actions/checkout v6 includes updates to support the Node 24 runtime [1]. Using this version ensures compatibility with the GitHub Actions environment as Node 20 is deprecated [3]. It requires a minimum Actions Runner version of v2.329.0 for specific features, such as persisting credentials in Docker container scenarios [5]. Note that as of August 2026, newer versions (e.g., v7) are available [6][7]. gitleaks/gitleaks-action v3 Released on May 30, 2026 [2][8], gitleaks/gitleaks-action v3 migrates the runtime from Node 20 to Node 24 [2][3]. This version is a direct replacement for v2, with no changes to inputs, outputs, or behavior [2][9]. Upgrading is necessary because GitHub is deprecating Node 20; Node 20 support on GitHub-hosted runners is scheduled to be removed entirely on September 16, 2026 [3][10]. v3 requires GitHub Actions runner v2.327.1 or later [3][9].

Citations:


Update the Node 20 actions before CI runs.

actions/checkout@v4 and gitleaks/gitleaks-action@v2 use Node 20. Replace them with actions/checkout@v6 and gitleaks/gitleaks-action@v3, which use Node 24, before GitHub removes Node 20 support in fall 2026.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 32 - 35, Update the GitHub Actions
versions in the CI workflow: replace actions/checkout@v4 with
actions/checkout@v6 and gitleaks/gitleaks-action@v2 with
gitleaks/gitleaks-action@v3, leaving the surrounding workflow configuration
unchanged.

Comment thread CHANGELOG.md
floor rather than the local runtime.
- No application code yet. No WordPress, no WooCommerce, no plugin or theme.
- Repository visibility, CI, and branch protection are configured in Issues #04–#06.
- Branch protection and deploy workflows are configured in Issues #05 and #06.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Mark branch protection as deferred.

This PR does not configure branch protection. Change “are configured” to “are deferred” or “will be configured” for Issue #05. The PR objective explicitly defers branch-protection enforcement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` at line 91, Update the changelog entry for Issues `#05` and `#06`
to state that branch protection is deferred or will be configured, rather than
claiming it is already configured; keep the deploy-workflow status accurate.

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.

1 participant