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

BUG FIX #538 #760

Merged
merged 16 commits into from
Jun 18, 2024
2 changes: 2 additions & 0 deletions .github/workflows/.lychee.excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
file:///github/workspace/*
file:///home/runner/work/opensearch-py/opensearch-py/docs/source/README.md
Copy link
Member

Choose a reason for hiding this comment

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

These are pattern matched/regexes, I think it should work without file://, try */github/workspace/* */docs/source/README.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically removing sym link before link checker is my solution . Excluding (file:///home/runner/work/opensearch-py/opensearch-py/docs/source/README.md ) is needed . Let me give u a example, if u have readme as a relative link in some other doc, link checker will fail, because we removed sym link before link checking started . So to avoid this case I excluded that reference from link checker.so basically it's not about excluding file to be checked in link checker, it's about excluding the reference to be link checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried excluding file using --exclude-path and --exclude-file , but it's excluding both readme files. So removing sym link may be the only option. At the end of link checking , I added sym link again so that it won't effect other workflow.

7 changes: 6 additions & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Remove symlink
Copy link
Member

Choose a reason for hiding this comment

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

What's the purpose of removing the symlink if we're going to exclude it below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried excluding file(docs/source/readme.md) from link checking, but link checker excluding readme.md in both root and also in docs/source , so I tried removing symlink ,then link checker worked. The exclude below is not for excluding file, there may be a reference to this symlink file in other doc, so to ensure that link checker doesn't validate this reference as it is now-nonexistent soft link. Although it will still work without excluding this.

Copy link
Member

Choose a reason for hiding this comment

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

Deleting the symlink is definitely a workaround, but not a pretty one. Let's figure out how to do without it, remove it.

You also have file:///home/runner/work/opensearch-py/opensearch-py/docs/source/README.md in .lychee.excludes, so it sounds like you're saying that it doesn't work?

run: rm docs/source/README.md
- name: lychee Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
args: --accept=200,403,429 "**/*.html" "**/*.md" "**/*.txt" "**/*.json" --exclude "file:///github/workspace/*" --exclude-mail
args: --accept=200,403,429 "**/*.html" "**/*.md" "**/*.txt" "**/*.json" --exclude-file ".github/workflows/.lychee.excludes" --exclude-mail
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Restore symlink
if: always()
run: ln -s ../../README.md docs/source/README.md
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fixed DeprecationWarning emitted from urllib3 1.26.13+ ([#246](https://github.com/opensearch-project/opensearch-py/pull/246))
- Fixed Wrong return type hint in `async_scan` ([520](https://github.com/opensearch-project/opensearch-py/pull/520))
- Fixed link checker failing due to relative link ([#760](https://github.com/opensearch-project/opensearch-py/pull/760))
### Security

[Unreleased]: https://github.com/opensearch-project/opensearch-py/compare/v2.6.0...HEAD
Expand All @@ -270,4 +271,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[2.2.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.1.1...v2.2.0
[2.1.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.0...v2.0.1
[2.0.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.0...v2.0.1
Loading