Skip to content

GitHub: analyze through the GraphQL API to cut requests and run time #637

Description

@Exypte

Is your feature request related to a problem? Please describe.

#619 counts every GitHub request and answers repeated reads from memory. An analyze still costs a lot: on the #619 corpus, a run sends between 36 (rust-lang/rust) and 493 (home-assistant/core) requests, one at a time. Most of them grow with the number of action references: each new owner/repo@ref costs 4 to 7 REST calls (inventory in #618).

Describe the solution you'd like

Move every GitHub read that GraphQL can batch to the GraphQL API. The cost of a run then grows per batch of action repositories, not per action reference. The run uses less of the rate limit and takes less time.

Decisions

  • The work starts from a branch cut from main with feat(github): send fewer GitHub requests per analyze #619 merged in, so the --debug report and the request counting are there to measure it.
  • A GitHub analyze needs a token. Without one, it stops at startup with a clear message. PLUMBER_DISABLE_GITHUB_API=1 stays the way to run without the API. The GITHUB_TOKEN of a workflow run works with GraphQL, so the Plumber action is not affected.
  • The REST code that GraphQL replaces is deleted, the anonymous retry of the tags listing too. There is no second path to keep in sync.
  • The client is go-gh api.NewGraphQLClient, already in the dependency tree.
  • A GraphQL answer is never kept in memory. feat(github): send fewer GitHub requests per analyze #619 makes sure of this in its memo transport.
  • A batched query can fail for one alias and work for the others. Each alias keeps the outcome its REST call has today:
    • NOT_FOUND means missing, like a 404.
    • An authentication or rate-limit error means could-not-verify, never missing. A batch that fails as a whole gives could-not-verify for all its aliases. This keeps the expired-token guarantee of feat(github): send fewer GitHub requests per analyze #619.
  • github.com and GitHub Enterprise Server must give the same result. When one side's schema lacks a field (for example securityVulnerabilities for the ACTIONS ecosystem, or the immutable release flag), that lookup uses the REST API on that side.

Scope

One PR per step, in this order:

  1. Action enrichment and definitions: repository fields (archived, stars, nameWithOwner), releases, tag, branch and commit resolution with tag peeling, advisories, the tags that map a SHA to a version, immutable releases, action.yml and action.yaml, reusable workflows. One aliased query per batch of repositories, one batch per nesting level. Most of the cost is here.
  2. The scanned repository: default branch, visibility, full name, branch listing and the releases written by the bot, in one query.
  3. Remote mode (--github-url with --project): the workflow listing and every workflow file in one tree query.

These stay on REST for now: rulesets and the rules that apply to a branch, classic branch protection details, environments, and the Actions workflows, runs, jobs and logs. Sending them concurrently is a later topic.

Out of scope: GitLab, and the ISSUE-714 entrypoint probing, which #619 fixes.

Measuring

Every query asks for rateLimit { cost remaining }. The --debug report gets a GraphQL section: the queries sent, the points each one cost, and the GraphQL budget before and after the run.

Done when

Implementation Hints

The REST calls to replace, with their place in the code:

  • github/github_metadata.go: repository, releases, tags, advisories, branch, commit and release lookups.
  • github/github_workflows.go (enrichActions): the per-ref and per-step tag resolution.
  • github/nested_actions.go and github/nested_workflows.go: action and reusable-workflow definitions, read today from raw.githubusercontent.com with a contents API fallback.
  • github/github_branch_protection.go: repository and branch reads of the scanned repository.
  • github/github_token_default.go: the releases listing.
  • github/github_workflows_remote.go: remote mode listing and file reads.

Why It's Valuable

Large repositories hit the rate limit (#618), and a run waits on hundreds of requests sent in sequence. Batching them in GraphQL makes analyze faster and lets it scan bigger repositories, or more of them, within the same budget.

Refs #618, #619

Activity

  1. added theissue type on Nov 24, 2026
  2. added
    github_actions
    go
    on Nov 24, 2026
  3. self-assigned this
    on Nov 24, 2026
  4. Exypte commented on Nov 24, 2026

    @Exypte
    ContributorAuthor

    I'm working on this one, a PR is on the way.

  5. added 6 commits that reference this issue on Nov 25, 2026
    b9ca063
    395e651
    d757bc9
    9f1272b
    e56a00b
    6eeb12a
  6. added a commit that references this issue on Nov 30, 2026
    53c5406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

github_actionsgo

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions