mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
add generate-query-help workflow
This commit is contained in:
53
.github/workflows/generate-query-help-docs.yml
vendored
Normal file
53
.github/workflows/generate-query-help-docs.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Generate CodeQL documentation using Sphinx
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'rc/**'
|
||||
- 'lgtm.com'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/language/query-help/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone github/codeql
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: codeql
|
||||
- name: Clone github/codeql-go
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'github/codeql-go'
|
||||
path: codeql-go
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Download CodeQL CLI
|
||||
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
|
||||
with:
|
||||
repo: "github/codeql-cli-binaries"
|
||||
version: "latest"
|
||||
file: "codeql-linux64.zip"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Unzip CodeQL CLI
|
||||
run: unzip -d codeql-cli codeql-linux64.zip
|
||||
- name: Query help to markdown
|
||||
run: |
|
||||
PATH="$PATH:codeql-cli/codeql" python codeql/docs/language/query-help-markdown.py
|
||||
- name: Run Sphinx for query help
|
||||
uses: ammaraskar/sphinx-action@master
|
||||
with:
|
||||
docs-folder: "codeql/docs/language/query-help/"
|
||||
pre-build-command: "python -m pip install --upgrade recommonmark"
|
||||
build-command: "sphinx-build -b html . query-help-build"
|
||||
- name: Upload HTML artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: query-help-html
|
||||
path: query-help
|
||||
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
import os
|
||||
|
||||
# Define which languages and query packs to consider
|
||||
languages = ["cpp", "csharp", "go", "java", "javascript", "python"]
|
||||
languages = ["go"]
|
||||
|
||||
# Running generate query-help with "security-and-quality.qls" generates errors, so just use these two suites for now
|
||||
packs = ["code-scanning", "security-extended"]
|
||||
@@ -96,7 +96,7 @@ except Exception as e:
|
||||
#
|
||||
# (and assumes the codeql-go repo is in a similar location)
|
||||
|
||||
# codeql_search_path = "./ql" or "./codeql-go" # will be extended further down
|
||||
codeql_search_path = "./codeql:./codeql-go" # will be extended further down
|
||||
|
||||
# Extend CodeQL search path by detecting root of the current Git repo (if any). This means that you
|
||||
# can run this script from any location within the CodeQL git repository.
|
||||
@@ -105,7 +105,7 @@ try:
|
||||
|
||||
# Current working directory is in a Git repo. Add it to the search path, just in case it's the CodeQL repo
|
||||
#git_toplevel_dir = git_toplevel_dir.stdout.strip()
|
||||
#codeql_search_path += ":" + git_toplevel_dir + ":" + git_toplevel_dir + "/../codeql-go"
|
||||
codeql_search_path += ":" + git_toplevel_dir + ":" + git_toplevel_dir + "/../codeql-go"
|
||||
codeql_search_path = git_toplevel_dir = git_toplevel_dir.stdout.strip()
|
||||
except:
|
||||
# git rev-parse --show-toplevel exited with non-zero exit code. We're not in a Git repo
|
||||
|
||||
Reference in New Issue
Block a user