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/'