From fdbf493389fb16d1717bc9fd692f56b36bf35a6b Mon Sep 17 00:00:00 2001 From: JJ Fullmer Date: Mon, 17 Aug 2026 19:56:47 -0600 Subject: [PATCH] Skip the vendor checks on branches with no composer.json The vendor job added in #16 assumes packages/web/composer.json exists. It does on working-1.6, where the dependency manager landed. It does not on dev-branch, and does not on any branch cut before that -- so `composer validate` answers "./composer.json not found." and exits 3, and the job fails. That turned every dev-branch pull request red the moment #16 merged. It is not a real finding on those branches: the absence is correct there, and the only way to make the check pass for real would be to port the whole dependency manager to the 1.5.x line, which is a decision that has nothing to do with whether a given PR is sound. So detect the manifest once after checkout and gate the PHP setup, validate, install, comparison and drift report on it. When it is missing the job emits a ::warning:: and a step-summary line saying it was skipped, then passes. Skip loudly rather than fail, or silently pass, because that is what this repo already does with the same class of problem: the generated-files sweep skips update-language.sh with a ::warning:: on branches that predate it, "rather than failing the whole job on a branch nobody can fix without rebasing". Same reasoning, same shape. Nothing changes on working-1.6: the manifest is there, every step runs as before. If the 1.5.x line ever gains a composer.json this starts checking it with no further change here. The drift report keeps its always() so it still reports after a failed content comparison -- it just also requires the manifest, since composer was never installed in the skip case and that step shells out to `composer --version`. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01PqufBbuckux8kitJeW3uAK --- .github/workflows/fogproject-tests.yml | 38 +++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fogproject-tests.yml b/.github/workflows/fogproject-tests.yml index 7d49fcd..1deafef 100644 --- a/.github/workflows/fogproject-tests.yml +++ b/.github/workflows/fogproject-tests.yml @@ -104,7 +104,36 @@ jobs: - name: Check out the pull request uses: actions/checkout@v4 + - name: Is there a Composer tree to check? + id: manifest + # dev-branch has no packages/web/composer.json at all, and neither does + # any branch cut before the dependency manager landed on working-1.6. + # Every step below assumes one: `composer validate` answers + # "./composer.json not found." and exits 3, so the whole check goes red + # on a branch that was never expected to have it and cannot be fixed + # without porting the dependency manager to it. That turned every + # dev-branch pull request red the moment this job was added. + # + # Skip loudly rather than fail, which is what the generated-files sweep + # already does for update-language.sh on branches that predate it: a + # visible ::warning::, not a silent pass, and not a failure for an + # absence that is correct on that branch. If the 1.5.x line ever gets a + # composer.json this starts checking it with no change here. + run: | + if [ -f packages/web/composer.json ]; then + echo "present=true" >> "$GITHUB_OUTPUT" + else + echo "present=false" >> "$GITHUB_OUTPUT" + echo "::warning::packages/web/composer.json is not on this branch; skipping the vendor checks." + { + echo '### vendor/' + echo '' + echo 'Skipped — this branch carries no `packages/web/composer.json`.' + } >> "$GITHUB_STEP_SUMMARY" + fi + - name: Set up PHP 7.4 and Composer + if: steps.manifest.outputs.present == 'true' uses: shivammathur/setup-php@v2 with: # 7.4 because composer.json pins config.platform.php to 7.4.0. The @@ -122,10 +151,12 @@ jobs: # and the installer reads its own version from the tree. Plain # validate still catches a malformed manifest and, more usefully, a # lock that has fallen out of step with the requirements. + if: steps.manifest.outputs.present == 'true' run: composer validate working-directory: packages/web - name: Reinstall from the lock + if: steps.manifest.outputs.present == 'true' run: composer install --no-interaction --no-progress working-directory: packages/web @@ -141,6 +172,7 @@ jobs: # elsewhere. The dependency's own files carry no such dependency and # are where a hand-edit or a stale package would show, so those fail # hard. + if: steps.manifest.outputs.present == 'true' run: | git diff --exit-code -- packages/web/vendor \ ':!packages/web/vendor/composer' \ @@ -151,7 +183,11 @@ jobs: # worth seeing: a change here means the tree was last regenerated by a # different Composer, which is the thing to know before believing a # vendor diff in some later pull request. - if: always() + # + # Still `always()` so it reports after a failed content comparison -- + # but not when the manifest is absent, since composer was never + # installed and the summary line has already been written above. + if: always() && steps.manifest.outputs.present == 'true' run: | { echo '### vendor/'