Skip to content

ci: pass GITHUB_TOKEN to pre-commit so lychee avoids GitHub throttling - #794

Merged
nikosavola merged 1 commit into
gdsfactory:mainfrom
jackgdsf:ci/lychee-github-token
Oct 15, 2026
Merged

nikosavola merged 1 commit into
gdsfactory:mainfrom
jackgdsf:ci/lychee-github-token

Conversation

@jackgdsf

@jackgdsf jackgdsf commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #793

The `lychee` hook in the `pre-commit` job checks github.com links unauthenticated, so GitHub sometimes answers with 503/429 and the job fails on links that are fine (e.g. #792: `Vlsir/Vlsir/blob/main/VlsirTools/readme.md` returned 503, but it returns 200).

This exports the workflow's `GITHUB_TOKEN` to the `pre-commit/action` step. lychee picks it up from the environment and checks GitHub links through the authenticated API. No other hooks use it.

`pre-commit run --all-files` passes locally.

Requested by @nikosavola

A human needs to review this before merge.

🤖 Generated with Claude Code

Summary by Sourcery

Authenticate GitHub link checks in the pre-commit CI job to avoid rate limiting and transient GitHub errors.

Bug Fixes:

  • Prevent intermittent pre-commit failures when checking GitHub links by providing lychee with authenticated GitHub API access.

CI:

  • Pass the workflow GITHUB_TOKEN to the pre-commit action.

Fixes gdsfactory#793

Co-authored-by: Niko Savola <niko@gdsfactory.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The pre-commit CI step now receives the workflow’s GITHUB_TOKEN, enabling lychee to perform authenticated GitHub link checks and avoid failures caused by unauthenticated API rate limits or transient 503/429 responses.

File-Level Changes

Change Details Files
Provide lychee with the workflow’s GitHub authentication token during pre-commit execution to reduce GitHub API throttling and transient link-check failures.
  • Export the repository GITHUB_TOKEN only for the pre-commit action step.
  • Allow lychee to discover and use the token from its environment while leaving other hooks unchanged.
.github/workflows/test_code.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#793 Pass the workflow's GitHub token to the pre-commit step so lychee can make authenticated GitHub link checks and avoid transient unauthenticated throttling failures. ✅

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The token becomes available to the pre-commit action and its hooks, so compromised or untrusted hook code could send it elsewhere and use whatever repository permissions it has before the token expires. Reverting removes the exposure going forward, but cannot undo any access or data exposure that already occurred.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@nikosavola nikosavola self-assigned this Oct 15, 2026
@nikosavola
nikosavola enabled auto-merge (rebase) October 15, 2026 14:15
@nikosavola
nikosavola merged commit d682b46 into gdsfactory:main Oct 15, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lychee pre-commit hook fails on transient GitHub 503s

2 participants