Skip to content

Commit 61ec68f

Browse files
committed
Generate the "Submit SARIF after failure" workflow
1 parent d0517be commit 61ec68f

File tree

3 files changed

+99
-34
lines changed

3 files changed

+99
-34
lines changed

.github/workflows/__submit-sarif-failure.yml

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/submit-sarif-failure.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Submit SARIF after failure
2+
description: Check that a SARIF file is submitted for the workflow run if it fails
3+
versions: ["latest", "cached", "nightly-latest"]
4+
operatingSystems: ["ubuntu"]
5+
6+
env:
7+
# Internal-only environment variable used to indicate that the post-init Action
8+
# should expect to upload a SARIF file for the failed run.
9+
CODEQL_ACTION_EXPECT_UPLOAD_FAILED_SARIF: true
10+
# Make sure the uploading SARIF files feature is enabled.
11+
CODEQL_ACTION_UPLOAD_FAILED_SARIF: true
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: ./init
16+
with:
17+
languages: javascript
18+
- name: Fail
19+
# We want this job to pass if the Action correctly uploads the SARIF file for
20+
# the failed run.
21+
# Setting this step to continue on error means that it is marked as completing
22+
# successfully, so will not fail the job.
23+
continue-on-error: true
24+
run: exit 1
25+
- uses: ./analyze
26+
# In a real workflow, this step wouldn't run. Since we used `continue-on-error`
27+
# above, we manually disable it with an `if` condition.
28+
if: false
29+
with:
30+
category: "/test-codeql-version:${{ matrix.version }}"

0 commit comments

Comments
 (0)