Skip to content

Commit e862dfd

Browse files
authored
QL: Merge pull request #102 from github/esbena/simple-codeql-action
make another codeql-action workflow that uses a published pack
2 parents 2352cf7 + 72d1473 commit e862dfd

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/codeql-analysis.yml renamed to .github/workflows/bleeding-codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL"
1+
name: "CodeQL with bleeding edge queries and extractor"
22

33
on:
44
workflow_dispatch:
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "CodeQL with published queries and extractor"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [ main ]
10+
11+
jobs:
12+
13+
analyze:
14+
name: Analyze
15+
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Download pack
28+
run: |
29+
# adjust this line to make the workflow work in other repositories
30+
# the ql-qlpack.zip file can be downloaded at:
31+
# - https://github.com/github/codeql-ql/releases
32+
# - https://github.com/github/codeql-ql/actions/workflows/bleeding-codeql-analysis.yml
33+
gh release download latest --pattern ql-qlpack.zip
34+
unzip ql-qlpack.zip -d "${PACK}"
35+
env:
36+
PACK: ${{ runner.temp }}/ql-qlpack
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Hack codeql-action options
40+
run: |
41+
JSON=$(jq -nc --arg pack "${PACK}" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
42+
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
43+
env:
44+
PACK: ${{ runner.temp }}/ql-qlpack
45+
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@esbena/ql
48+
with:
49+
languages: ql
50+
db-location: ${{ runner.temp }}/db
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@esbena/ql

0 commit comments

Comments
 (0)