Skip to content

Cannot run CodeQL via required workflows #5

Open

Description

@billnapier
The following actions are not allowed to be used inside a required workflow: github/codeql-action/analyze@v3, github/codeql-action/init@v3

Reading GH Docs

CodeQL is not supported in required workflows because CodeQL requires configuration at the repository level.

Which generally is true, but in this case we're actually fine.

Activity

  1. added a commit that references this issue on Feb 24, 2025
  2. added a commit that references this issue on Feb 24, 2025
  3. marcellodesales commented on May 8, 2025

    @marcellodesales

    This really sucks!

    The actions github/codeql-action/analyze@v3 and github/codeql-action/init@v3 are not allowed to be used within a required workflow because they require accessing information about the workflow's run ID, and this is not possible when the workflow is required. Specifically, the CodeQL action needs to determine the workflow's run ID for internal processes, and this information is not available when the workflow is triggered as a requirement.
    Here's a more detailed explanation:
    Required Workflows and Run IDs:
    When a workflow is marked as "required," it means that the workflow must be executed as a pre-condition before the next step in a CI/CD pipeline can proceed.
    CodeQL Action Requirements:
    The CodeQL action, specifically the analyze and init steps, relies on obtaining the workflow's run ID to correctly perform its tasks.
    Compatibility Issues:
    The requirement of obtaining the run ID becomes incompatible with required workflows because the run ID information is not accessible within the context of a required workflow.
    Workarounds:
    To address this, you'll need to structure your workflow to avoid using the CodeQL actions directly within a required workflow. A common approach is to separate the CodeQL analysis into a separate, non-required workflow that can be triggered after the required workflows have completed successfully.
    For a more helpful explanation to your specific error, you may need to include more details about the context in which you are receiving this error, such as the specific workflow file and the steps that trigger the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions