make removed URL check aware of docs/redirects.txt - #612
Conversation
|
@SecondSkoll I think you were the principal author behind this script, so I'd like to defer this one to you. |
SecondSkoll
left a comment
There was a problem hiding this comment.
Checked and validated against my own docs, works just fine.
Note: The old check was broken by the introduction of rerediraffe.
|
@jahn-junior While this might not fit our ultimate goals for rerediraffe, this fixes a broken workflow. If the script were moved to an external file, would that be a satisfactory stop-gap? |
No complaints from me. I haven't had time to look at the Python in detail, but it seems simple enough. |
SecondSkoll
left a comment
There was a problem hiding this comment.
Could you please move the Python script in the "Compare URLs" step to /docs/_dev/, and then then call it in the workflow?
@SecondSkoll please let me know what you think? |
SecondSkoll
left a comment
There was a problem hiding this comment.
LGTM, @jahn-junior any final notes or are you happy to merge this in now?
jahn-junior
left a comment
There was a problem hiding this comment.
I'm happy with the overall shape of this. Just one question about the args in the Python script. Once we've settled that, I'll go ahead and merge.
| * `docs/Makefile` [#605](https://github.com/canonical/sphinx-stack/pull/605), [#610](https://github.com/canonical/sphinx-stack/pull/610) | ||
| * `README.md` [#603](https://github.com/canonical/sphinx-stack/pull/603) | ||
| * `.github/workflows/cla-check.yml` [#606](https://github.com/canonical/sphinx-stack/pull/606) | ||
| * `.github/workflows/check-removed-urls.yml` [#PR_NUMBER](https://github.com/canonical/sphinx-stack/pull/#PR_NUMBER) |
There was a problem hiding this comment.
| * `.github/workflows/check-removed-urls.yml` [#PR_NUMBER](https://github.com/canonical/sphinx-stack/pull/#PR_NUMBER) | |
| * `.github/workflows/check-removed-urls.yml` [#612](https://github.com/canonical/sphinx-stack/pull/612) |
Leaving this comment so we don't forget to replace these before merge.
Description
This PR updates the
check-removed-urls.ymlGitHub workflow to prevent false positives when a documentation page is intentionally removed or renamed, but a proper redirect has already been configured indocs/redirects.txt.Previously, the workflow performed a strict text diff on the built HTML output. If a URL disappeared, the check failed immediately, completely unaware that a redirect existed.
Key Changes
workflow_callInputs: decoupled the base reference variables so this workflow can be cleanly reused by other pipelines.findandsedpipeline to parse built HTML structures safely and output clean, predictable path formats.docs/redirects.txtusing the nativecsvmodule and checks all structural markdown possibilities (page.md,page/index.md, or directory-level paths) before flagging a URL as missing.Testing Instructions
docs/redirects.txt, the workflow should fail and list the unhandled URL.docs/redirects.txt, the workflow should print a green checkmark (✅ Ignored) and pass successfully.Checklist
redirects.txtCHANGELOG.mdwith relevant non-documentation file changes?