Skip to content

Commit 2e67a32

Browse files
committed
Add option to manually trigger the workflow
1 parent 1297d1c commit 2e67a32

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

.github/workflows/csv-coverage.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Build CSV flow coverage report
22

33
on:
4+
workflow_dispatch:
5+
inputs:
6+
qlModelShaOverride:
7+
description: 'github/codeql repo SHA used for looking up the CSV models'
8+
required: false
49
push:
510
branches:
611
- main
@@ -22,7 +27,18 @@ jobs:
2227
- name: Clone self (github/codeql)
2328
uses: actions/checkout@v2
2429
with:
25-
path: codeql
30+
path: script
31+
- name: Clone self (github/codeql) at a given SHA for analysis
32+
if: github.event.inputs.qlModelShaOverride != ''
33+
uses: actions/checkout@v2
34+
with:
35+
path: codeqlModels
36+
ref: github.event.inputs.qlModelShaOverride
37+
- name: Clone self (github/codeql) for analysis
38+
if: github.event.inputs.qlModelShaOverride == ''
39+
uses: actions/checkout@v2
40+
with:
41+
path: codeqlModels
2642
- name: Set up Python 3.8
2743
uses: actions/setup-python@v2
2844
with:
@@ -38,7 +54,7 @@ jobs:
3854
run: unzip -d codeql-cli codeql-linux64.zip
3955
- name: Build modeled package list
4056
run: |
41-
PATH="$PATH:codeql-cli/codeql" python codeql/misc/scripts/generate-csv-coverage-report.py codeql
57+
PATH="$PATH:codeql-cli/codeql" python script/misc/scripts/generate-csv-coverage-report.py codeqlModels script
4258
- name: Upload CSV package list
4359
uses: actions/upload-artifact@v2
4460
with:

misc/scripts/generate-csv-coverage-report.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,27 @@ def __init__(self, lang, capitalized_lang, ext, ql_path):
120120
print("Error: couldn't invoke CodeQL CLI 'codeql'. Is it on the path? Aborting.", file=sys.stderr)
121121
raise e
122122

123-
prefix = ""
123+
query_prefix = ""
124+
data_prefix = ""
124125
if len(sys.argv) > 1:
125-
prefix = sys.argv[1] + "/"
126+
query_prefix = sys.argv[1] + "/"
127+
128+
if len(sys.argv) > 2:
129+
data_prefix = sys.argv[2] + "/"
126130

127131
# Languages for which we want to generate coverage reports.
128132
configs = [
129133
LanguageConfig(
130-
"java", "Java", ".java", prefix + "java/ql/src/meta/frameworks/Coverage.ql")
134+
"java", "Java", ".java", query_prefix + "java/ql/src/meta/frameworks/Coverage.ql")
131135
]
132136

133137
# The names of input and output files. The placeholder {language} is replaced with the language name.
134138
output_rst = "flow-model-coverage.rst"
135139
output_rst_csv = "rst-csv-flow-model-coverage-{language}.csv"
136140
output_ql_csv = "output-{language}.csv"
137141
output_csv = "csv-flow-model-coverage-{language}.csv"
138-
input_framework_csv = prefix + "misc/scripts/frameworks-{language}.csv"
139-
input_cwe_sink_csv = prefix + "misc/scripts/cwe-sink-{language}.csv"
142+
input_framework_csv = data_prefix + "misc/scripts/frameworks-{language}.csv"
143+
input_cwe_sink_csv = data_prefix + "misc/scripts/cwe-sink-{language}.csv"
140144

141145
with open(output_rst, 'w') as rst_file:
142146
for config in configs:

0 commit comments

Comments
 (0)