Unable to run custom queries against GitHub Actions

Open
#2,755 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
github-actions
Domain
ci-cd, security

Research direction

Start by comparing the standalone CodeQL commands with the GitHub Actions invocation and the generated codescanning configuration. Inspect actions-queries/pull_request_target.ql and the workflow shown in the linked pull request, then rerun the workflow after identifying why no Actions queries are defined. Done means the custom query runs through Actions without the fatal error.

Written by the indexing model from the issue text.

Description

awaiting-response

I've been trying to use codeql to check my GitHub Actions workflows. I've got it kinda working here:

https://github.com/billnapier/github-actions-check-workflow/pulls

I can test things, and when I run codeql standalone, stuff works just fine:

codeql database create --force-overwrite --db-cluster /workspaces/c 
--source-root=/workspaces/github-actions-check-workflow --calculate-language-specific-baseline --extractor-include-aliases --sublanguage-file-
coverage --language=actions --search-path /workspaces/codeql-action --build-mode=none

and then run the query:

codeql query run --database /workspaces/c/actions -- actions-queries/pull_request_target.ql

So my query is well formed, and I can generate the DB. But when I try and run it via Actions, I get this output instead (also in the PR):

Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.20.3/x64/codeql/codeql database init --force-overwrite --db-cluster /home/runner/work/_temp/codeql_databases --source-root=/home/runner/work/github-actions-check-workflow/github-actions-check-workflow --calculate-language-specific-baseline --extractor-include-aliases --sublanguage-file-coverage --language=actions --search-path /home/runner/work/_actions/github/codeql-action/v3/actions-extractor --codescanning-config=/home/runner/work/_temp/user-config.yaml --build-mode=none". Exit code was 2 and error was: A fatal error occurred: No queries defined for actions. See the logs for more details.

I've been trying to debug the "No queries defined for actions", but I'm stumped. I'm guessing that I'm missing something specifying what language my query is used for, but I have no idea what I'm missing.

Dominant language
TypeScript
Stars
1.6k
Forks
493
Avg merge
1d 13h
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-action

All issues in github/codeql-action

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.