Skip to content

Commit bc33041

Browse files
committed
Always run codeql (latest) job on PRs so we can make it required
1 parent c7203c9 commit bc33041

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,19 @@ jobs:
4646
CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
4747
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
4848
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
49-
if [[ "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
50-
# Just use `tools: null` to avoid duplication in the analysis job.
49+
50+
# If we're running on a pull request, run with both bundles, even if `tools: latest` would
51+
# be the same as `tools: null`. This allows us to make the job for each of the bundles a
52+
# required status check.
53+
#
54+
# If we're running on push, then we can skip running with `tools: latest` when it would be
55+
# the same as running with `tools: null`.
56+
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
5157
VERSIONS_JSON='[null]'
5258
else
53-
# Use both `tools: null` and `tools: latest` in the analysis job.
5459
VERSIONS_JSON='[null, "latest"]'
5560
fi
61+
5662
# Output a JSON-encoded list with the distinct versions to test against.
5763
echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
5864
echo "::set-output name=versions::${VERSIONS_JSON}"

0 commit comments

Comments
 (0)