tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Run linkcheck only with ready for merge label

Open martinhoyer opened this issue 10 months ago • 1 comments

I was thinking how to run the linkcheck only sparsely, like once per release, like having manual trigger and adding it to contributors guide, to start it before the release PR is merged. Or having it run once per week/14 days, or on tag, or creating a new label for release PR, or tagging the release commit before merging, or running it on merge to main, etc....

Ultimately went with just checking for ready-for-merge, still don't like it - suggestions welcome!

Also, aren't we hitting secondary rate limits? Perhaps we might be able to create a "app" token for this job so it has primary limits?

martinhoyer avatar May 09 '25 14:05 martinhoyer

Ultimately went with just checking for ready-for-merge, still don't like it - suggestions welcome!

I'm now convinced running it sparsely will not help with what I observed today. I'm trying to merge a couple of PRs, and pretty much all of them produce a failed linkcheck job. There is very little parallel action involved; there is no point in testing multiple PRs at the same time, so it's just one, rebase, tests, merge, rebase other, and so on, so it's not like we are running dozens of linkcheck jobs at once. One, maybe two. And they still keep failing. Based on that, I suspect even a sparsely run linkcheck job would fail, be it once per release, or for every tag, or just before the merge, because Github does not like it in general, not because it's too many of them spamming its services.

Also, aren't we hitting secondary rate limits? Perhaps we might be able to create a "app" token for this job so it has primary limits?

That sounds like something worth exploring. If we could stop being treated as someone who tries to overload Github by testing 50 links every 2 hours or so, it would IMHO address the issue. We could then still run linkcheck sparsely if we decided. No idea how to get us out of that box though :/

happz avatar May 13 '25 14:05 happz

Also, aren't we hitting secondary rate limits? Perhaps we might be able to create a "app" token for this job so it has primary limits?

That sounds like something worth exploring. If we could stop being treated as someone who tries to overload Github by testing 50 links every 2 hours or so, it would IMHO address the issue. We could then still run linkcheck sparsely if we decided. No idea how to get us out of that box though :/

I also had a draft which used gh api to check for remaining available limits, so we could skip the test. Will try to dig into it a bit more.

martinhoyer avatar May 14 '25 09:05 martinhoyer

I have an idea of how to cache the results and I think I can implement it here first and then expand it upstream^1.

Edit: here is my silly idea.

LecrisUT avatar May 16 '25 11:05 LecrisUT

@coderabbitai full review

martinhoyer avatar May 19 '25 15:05 martinhoyer

📝 Walkthrough

Walkthrough

A new reusable GitHub Action was introduced to set up the Python and Hatch environments for documentation builds. The documentation workflow was updated to use this action, add conditional execution of the Sphinx linkcheck based on GitHub API rate limits, and improve messaging. The Sphinx configuration was modified to use custom headers and optional authentication for GitHub link checks.

Changes

File(s) Change Summary
.github/actions/setup-docs-env/action.yml Added a composite GitHub Action to set up Python and Hatch environments for documentation, with caching and configurable Python version.
.github/workflows/doc-tests.yml Updated workflow to use the new setup-docs-env action, renamed job, added conditional Sphinx linkcheck step based on GitHub API rate limits, and improved warning messages for skipped link checks.
docs/conf.py Modified Sphinx linkcheck configuration to add custom headers for GitHub URLs, optionally use a GitHub token for authenticated requests, and print relevant messages based on token availability.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow
    participant SetupDocsEnvAction
    participant Sphinx
    participant GitHubAPI

    Workflow->>SetupDocsEnvAction: Run setup-docs-env (Python, Hatch, cache)
    SetupDocsEnvAction-->>Workflow: Environment ready

    Workflow->>Sphinx: Build HTML docs

    Workflow->>GitHubAPI: Query API rate limit
    GitHubAPI-->>Workflow: Return remaining rate limit

    alt Rate limit > 100
        Workflow->>Sphinx: Run linkcheck
        Sphinx->>GitHubAPI: Check GitHub links (with headers/token)
    else Rate limit <= 100
        Workflow->>Workflow: Skip linkcheck, emit warning
    end
sequenceDiagram
    participant Sphinx
    participant GitHub

    Sphinx->>GitHub: HTTP HEAD/GET (with User-Agent header)
    alt GITHUB_TOKEN present
        Sphinx->>GitHub: Add Authorization: Bearer <token>
    else GITHUB_TOKEN absent
        Sphinx->>GitHub: No Authorization header
    end
    GitHub-->>Sphinx: Respond to link check

[!NOTE]

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Learn more here.


[!NOTE]

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings. Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efecd12d5dc9295ecd4d4b7561241c280f168aa1 and 0f8f8955a11506748d51fdf1e609b1fbe9ecd7bc.

📒 Files selected for processing (3)
  • .github/actions/setup-docs-env/action.yml (1 hunks)
  • .github/workflows/doc-tests.yml (1 hunks)
  • docs/conf.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/conf.py
  • .github/workflows/doc-tests.yml
  • .github/actions/setup-docs-env/action.yml
⏰ Context from checks skipped due to timeout of 90000ms (44)
  • GitHub Check: testing-farm:centos-stream-9-x86_64:core
  • GitHub Check: testing-farm:centos-stream-9-x86_64:core
  • GitHub Check: testing-farm:centos-stream-9-x86_64:core
  • GitHub Check: testing-farm:fedora-42-x86_64:core
  • GitHub Check: testing-farm:fedora-42-x86_64:core
  • GitHub Check: testing-farm:fedora-42-x86_64:core
  • GitHub Check: osh-diff-scan:fedora-rawhide-x86_64
  • GitHub Check: testing-farm:fedora-42-x86_64:internal-wow
  • GitHub Check: testing-farm:fedora-42-x86_64:internal-plugins
  • GitHub Check: testing-farm:fedora-42-x86_64:provision
  • GitHub Check: testing-farm:fedora-42-x86_64:extended-unit-tests
  • GitHub Check: testing-farm:fedora-42-x86_64:full
  • GitHub Check: testing-farm:fedora-42-x86_64:core
  • GitHub Check: testing-farm:centos-stream-9-x86_64:full
  • GitHub Check: testing-farm:fedora-rawhide-x86_64:full
  • GitHub Check: testing-farm:fedora-41-x86_64:full
  • GitHub Check: testing-farm:centos-stream-9-x86_64:core
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: testing-farm:fedora-42-x86_64:internal-wow
  • GitHub Check: testing-farm:fedora-42-x86_64:internal-plugins
  • GitHub Check: testing-farm:fedora-42-x86_64:provision
  • GitHub Check: testing-farm:fedora-42-x86_64:extended-unit-tests
  • GitHub Check: testing-farm:fedora-42-x86_64:full
  • GitHub Check: testing-farm:fedora-rawhide-x86_64:full
  • GitHub Check: testing-farm:centos-stream-9-x86_64:full
  • GitHub Check: testing-farm:fedora-41-x86_64:full
  • GitHub Check: testing-farm:fedora-42-x86_64:core
  • GitHub Check: testing-farm:centos-stream-9-x86_64:core
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: Sphinx Documentation Tests

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 19 '25 15:05 coderabbitai[bot]

@coderabbitai review

martinhoyer avatar May 21 '25 10:05 martinhoyer

No reviews, touching essential parts, not suitable for the last minute inclusion, dropped from 1.49.

psss avatar May 21 '25 11:05 psss

No reviews, touching essential parts, not suitable for the last minute inclusion, dropped from 1.49.

Oh, wrong browser tab. That should have gone to #3581.

psss avatar May 21 '25 11:05 psss

Documentation only and docs build successfully finished, merging.

psss avatar May 21 '25 13:05 psss