File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # dep: https://github.com/cli/cli
4+ # e.g. get_codeql_db.sh ntp-project/ntp cpp
5+
6+ # CodeQL languages:
7+ #
8+ # - cpp: The C and C++ programming language
9+ # - csharp: The C# programming language
10+ # - go: The Go programming language
11+ # - java: The Java programming language
12+ # - python: The Python programming language
13+ # - ruby: The Ruby programming language
14+ # - swift: The Swift programming language
15+ # - rust: The Rust programming language
16+
17+ if [[ " $# " -ne 2 ]]; then
18+ echo " Usage: $0 github/nwo language"
19+ exit 1
20+ fi
21+
22+ db_info=$( gh api /repos/" $1 " /code-scanning/codeql/databases --jq " .[] | select(.language == \" $2 \" )" )
23+
24+ if [[ " $? " -ne 0 ]]; then
25+ exit 1
26+ fi
27+
28+ if [[ $db_info ]]; then
29+ dst=$( echo " $1 _$2 _codeql_db.zip" | sed ' s/\//_/g' )
30+ echo " Downloading CodeQL database to $PWD /$dst "
31+ if [ -e " $dst " ]; then
32+ echo " $dst already exists!"
33+ exit 1
34+ fi
35+ gh api /repos/" $1 " /code-scanning/codeql/databases/" $2 " -H ' Accept: application/zip' > " $dst "
36+ echo " Unzip database before use!"
37+ else
38+ echo " No $2 database available for $1 "
39+ exit 1
40+ fi
You can’t perform that action at this time.
0 commit comments