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

Adding Link Check on PRs #3085

Merged
merged 6 commits into from
Oct 17, 2024
Merged

Adding Link Check on PRs #3085

merged 6 commits into from
Oct 17, 2024

Conversation

sekyondaMeta
Copy link
Contributor

Adding link checking on PRs. This uses lychee and the lychee action as well as code from here

Basic breakdown:

  1. Clone the repository.
  2. Check out the main branch.
  3. Dump all links from the main branch using lychee-action and save them to a file called "links-main.txt".
  4. Stash any untracked files.
  5. Check out the feature branch that triggered the pull request.
  6. Apply any stashed changes.
  7. Append the contents of "links-main.txt" to the ".lycheeignore" file.
  8. Check the links using lychee-action and fail the job if any broken links are found.
  9. If the job fails, print a message suggesting that the user review the broken links and consider adding them to the ".lycheeignore" file to bypass future checks.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

Sorry, something went wrong.

@sekyondaMeta sekyondaMeta requested a review from svekars October 8, 2024 18:04
Copy link

pytorch-bot bot commented Oct 8, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3085

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit f7cef1f with merge base 1841346 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

I've never used that action in the past, but if it works, this sounds great. Would be nice to test it, by adding 1-2 broken links in this PR (and than removing the change) to see that workflow will start to fail


- name: Dump all links from main
id: dump_links_from_main
uses: lycheeverse/lychee-action@v1
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything wrong with using v2 version?

Suggested change
uses: lycheeverse/lychee-action@v1
uses: lycheeverse/lychee-action@v2


on:
pull_request:
branches: [main]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why limit it to a specific branch?

Suggested change
branches: [main]

- name: Check out main branch
run: git checkout main

- name: Dump all links from main
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- name: Dump all links from main
- name: Dump all links from ${{github.event.pull_request.base.ref}}

Comment on lines +21 to +22
- name: Check out main branch
run: git checkout main
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- name: Check out main branch
run: git checkout main
- name: Check out ${{github.event.pull_request.base.ref}} branch
run: git checkout ${{github.event.pull_request.base.ref}}

@sekyondaMeta sekyondaMeta reopened this Oct 17, 2024
@sekyondaMeta sekyondaMeta merged commit fad5956 into pytorch:main Oct 17, 2024
22 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants