GeezerVison is showing github.com — add generate-query-help workflow · optionalg/codeql@8504724
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +53Lines changed: 53 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: Generate CodeQL documentation using Sphinx |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'rc/**' |
| 8 | + - 'lgtm.com' |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - 'docs/language/query-help/**' |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Clone github/codeql |
| 18 | + uses: actions/checkout@v2 |
| 19 | + with: |
| 20 | + path: codeql |
| 21 | + - name: Clone github/codeql-go |
| 22 | + uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + repository: 'github/codeql-go' |
| 25 | + path: codeql-go |
| 26 | + - name: Set up Python 3.8 |
| 27 | + uses: actions/setup-python@v2 |
| 28 | + with: |
| 29 | + python-version: 3.8 |
| 30 | + - name: Download CodeQL CLI |
| 31 | + uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c |
| 32 | + with: |
| 33 | + repo: "github/codeql-cli-binaries" |
| 34 | + version: "latest" |
| 35 | + file: "codeql-linux64.zip" |
| 36 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + - name: Unzip CodeQL CLI |
| 38 | + run: unzip -d codeql-cli codeql-linux64.zip |
| 39 | + - name: Query help to markdown |
| 40 | + run: | |
| 41 | + PATH="$PATH:codeql-cli/codeql" python codeql/docs/language/query-help-markdown.py |
| 42 | + - name: Run Sphinx for query help |
| 43 | + uses: ammaraskar/sphinx-action@master |
| 44 | + with: |
| 45 | + docs-folder: "codeql/docs/language/query-help/" |
| 46 | + pre-build-command: "python -m pip install --upgrade recommonmark" |
| 47 | + build-command: "sphinx-build -b html . query-help-build" |
| 48 | + - name: Upload HTML artifacts |
| 49 | + uses: actions/upload-artifact@v2 |
| 50 | + with: |
| 51 | + name: query-help-html |
| 52 | + path: query-help |
| 53 | + |
Collapse file
Copy file name to clipboardExpand all lines: docs/language/query-help-markdown.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
6 | 6 | import os |
7 | 7 |
|
8 | 8 | # Define which languages and query packs to consider |
9 | | -languages = ["cpp", "csharp", "go", "java", "javascript", "python"] |
| 9 | +languages = ["go"] |
10 | 10 |
|
11 | 11 | # Running generate query-help with "security-and-quality.qls" generates errors, so just use these two suites for now |
12 | 12 | packs = ["code-scanning", "security-extended"] |
@@ -96,7 +96,7 @@ def subprocess_run(cmd): |
96 | 96 | # |
97 | 97 | # (and assumes the codeql-go repo is in a similar location) |
98 | 98 |
|
99 | | -# codeql_search_path = "./ql" or "./codeql-go" # will be extended further down |
| 99 | +codeql_search_path = "./codeql:./codeql-go" # will be extended further down |
100 | 100 |
|
101 | 101 | # Extend CodeQL search path by detecting root of the current Git repo (if any). This means that you |
102 | 102 | # can run this script from any location within the CodeQL git repository. |
@@ -105,7 +105,7 @@ def subprocess_run(cmd): |
105 | 105 |
|
106 | 106 | # Current working directory is in a Git repo. Add it to the search path, just in case it's the CodeQL repo |
107 | 107 | #git_toplevel_dir = git_toplevel_dir.stdout.strip() |
108 | | - #codeql_search_path += ":" + git_toplevel_dir + ":" + git_toplevel_dir + "/../codeql-go" |
| 108 | + codeql_search_path += ":" + git_toplevel_dir + ":" + git_toplevel_dir + "/../codeql-go" |
109 | 109 | codeql_search_path = git_toplevel_dir = git_toplevel_dir.stdout.strip() |
110 | 110 | except: |
111 | 111 | # git rev-parse --show-toplevel exited with non-zero exit code. We're not in a Git repo |
|