Skip to content

Commit a5215a8

Browse files
fix: gate codeql's language matrix on an actual js/ts app being present
Ungated, a php-only project got a CodeQL job that scanned its docs site and reported that as security coverage. Gate the same way the php provisioning step in app-ci.yml is gated: on file presence, not on an adapter name.
1 parent bc3aea6 commit a5215a8

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎.github/workflows/app-security.yml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,26 @@ jobs:
1818
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1919
with:
2020
persist-credentials: false
21-
- uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
21+
# CodeQL has no PHP analyser, and its own API requires naming a
22+
# language to scan — unlike installing an interpreter, that name
23+
# cannot be derived away. gated on the same file-presence shape the
24+
# php step in app-ci.yml uses, not on an adapter name, so a
25+
# php-only project does not get a job that scans its docs site and
26+
# calls that security coverage (docs/decisions/0016-php-is-not-pinned-through-mise.md
27+
# in the scaffold toolbox repo, second exception).
28+
- id: has-javascript
29+
run: |
30+
if compgen -G "apps/*/package.json" > /dev/null; then
31+
echo "present=true" >> "$GITHUB_OUTPUT"
32+
else
33+
echo "present=false" >> "$GITHUB_OUTPUT"
34+
fi
35+
- if: steps.has-javascript.outputs.present == 'true'
36+
uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
2237
with:
2338
languages: ${{ matrix.language }}
24-
- uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
39+
- if: steps.has-javascript.outputs.present == 'true'
40+
uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
2541

2642
zizmor:
2743
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)