Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run linkcheck on 'release' PR workflow #2332

Merged
merged 5 commits into from
Apr 29, 2024
Merged

Run linkcheck on 'release' PR workflow #2332

merged 5 commits into from
Apr 29, 2024

Conversation

cosenal
Copy link
Contributor

@cosenal cosenal commented Apr 28, 2024

Fixes #2283 as agreed in Mitiq community call on April 26, 2024.

Description

Linkcheck was disabled in #2287, because it was making every pull request (PR) build fail with false errors. Some websites (e.g., doi.org) have bot-preventive measures for which they return 4xx errors when a request is made. In this PR we ignore those websites, on the assumption that we trust their links are not going to break.

Some false errors may still occurr, so we decided to do a linkcheck pass only on 'release' PRs.

How do you detect a 'release' PR?

We check whether the word 'release' is in the PR title (case-insensitive). This will have some false positives (just like this PR itself 😝 ), but it should have no false negatives, see this search on past release PRs. On false positives we just run make linkcheck superfluously, not a big deal.

Bonus

I fixed some linkcheck warning by explicitly replacing links that have been redirected since the time they were added to our docs.

Testing

The new step was tested locally with

act pull_request -e act_event.json --container-architecture linux/amd64 -j docs

where act_event.json is a file with content

{
  "pull_request": {
    "title": "this is a relEAse PR"
  }
}

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.22%. Comparing base (ccb9ff6) to head (c3a9474).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2332      +/-   ##
==========================================
+ Coverage   98.19%   98.22%   +0.02%     
==========================================
  Files          87       87              
  Lines        4052     4052              
==========================================
+ Hits         3979     3980       +1     
+ Misses         73       72       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@purva-thakre
Copy link
Collaborator

I think you should add the details from How do you detect a 'release' PR? in your PR description to this section of the docs.

@cosenal
Copy link
Contributor Author

cosenal commented Apr 28, 2024

I think you should add the details from How do you detect a 'release' PR? in your PR description to this section of the docs.

@purva-thakre Yes, good idea

@cosenal
Copy link
Contributor Author

cosenal commented Apr 28, 2024

@purva-thakre comment addressed, PTAL

Copy link
Collaborator

@purva-thakre purva-thakre left a comment

Choose a reason for hiding this comment

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

LGTM!

docs/source/release.md Show resolved Hide resolved
@cosenal cosenal merged commit 9a90339 into main Apr 29, 2024
18 checks passed
@cosenal cosenal deleted the linkcheck-on-release branch April 29, 2024 12:50
@cosenal
Copy link
Contributor Author

cosenal commented Apr 30, 2024

You can see this in action now! https://github.com/unitaryfund/mitiq/actions/runs/8899188557/job/24437953232?pr=2338
🎉 well.. linkcheck fails, but the change from this PR is working :)

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.

Add a scheduled linkcheck workflow
2 participants