Skip to main content
A diff shows which lines changed. The graph shows what those lines touch. This recipe builds a code graph in GitHub Actions and posts each pull request’s impact (nodes, communities and files) as a comment, so reviewers see how far a change reaches before they open the diff.

What you’ll build

  • A workflow that runs on every pull request.
  • A headless code graph built without an LLM or API key.
  • A PR comment from graphify prs <number> showing the graph impact.

Setup

You need a GitHub repository and permission to add workflows. Try the command locally first:
prs uses the GitHub CLI, so run gh auth login first.

Step 1: Read the impact locally

graphify prs with no number lists open pull requests against the base branch. On the open-source Graphify repository it printed:
With a number, it prints the detail for one pull request: status, branch, CI, and its graph impact. For one pull request on the open-source repository:
It then lists the communities the change touches and the files it changes. Useful flags:

Step 2: Add the workflow

Create .github/workflows/graph-impact.yml:
--code-only parses source with tree-sitter and needs no LLM, so the job needs no secret beyond the built-in GITHUB_TOKEN. --edit-last --create-if-none updates one comment rather than adding a new one on every push.

Step 3: Open a pull request

Push a branch and open a pull request. When the job finishes, the comment shows the impact summary, the communities touched and the changed files. A small, focused change touches one or two communities. A change across many is worth a closer review, or splitting.

When it goes wrong

gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Add the env block with GH_TOKEN to each step that calls gh or graphify prs. Resource not accessible by integration. The workflow needs pull-requests: write. Pull requests from forks get a read-only token. Run on pull_request_target only if you understand the risk of running fork code with write access, or skip the comment for forks. --create-if-none is unknown. Your runner has an old GitHub CLI. Drop both flags to post a new comment each time. The job is slow on a large repository. Cache graphify-out/ with actions/cache, keyed on the base branch, and run graphify update . instead of a full extract.

Production patterns

  • Fail the job, or add a label, when a pull request touches more communities than your team’s limit.
  • Add graphify prs --conflicts to a scheduled workflow to list pull requests that may conflict.
  • For test selection from the graph, see the hosted Buildkite test impact integration.

Complete example

The workflow in Step 2 is complete. Copy it to .github/workflows/graph-impact.yml, commit and open a pull request.

What you built

Every pull request gets a comment showing how much of the graph it touches, built in CI with no API key, so reviewers know the blast radius up front.

Next steps

Pull requests

Triage, conflicts and impact for open pull requests.

Review as a team

Use graph impact to plan reviews.

Try it in Graphify

We build and host the graph for you. Start with a 14-day Pro trial, then keep up to 3 repositories on Free. No card required.