Skip to content

Conversation

@waldyrious
Copy link
Member

Refactor the monthly username validation workflow for improved clarity and maintainability.

Also update lychee.md to the link to the CLI documentation page in the docs site.

@github-actions github-actions bot added page edit Changes to an existing page(s). tooling Helper tools, scripts and automated processes. labels Oct 31, 2025
@waldyrious waldyrious marked this pull request as draft October 31, 2025 19:30
Comment on lines -16 to -22
- name: Restore lychee cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
Copy link
Member Author

@waldyrious waldyrious Oct 31, 2025

Choose a reason for hiding this comment

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

I removed cache read/write steps because the default cache duration is 1 day while we're running this only once a month, so the cace would be expired anyway. Besides, we don't want to cache results, since indeed they may change between runs.

@waldyrious waldyrious force-pushed the username-check-improvements branch from c17ad30 to 9f056fc Compare October 31, 2025 19:48
id: last-issue # Step ID to reference later
with:
state: open
state: all
Copy link
Member Author

@waldyrious waldyrious Oct 31, 2025

Choose a reason for hiding this comment

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

There's no need to only update an existing issue if it is open; so I changed this to search for closed ones too, and modified the last step in the workflow to reopen the closed issue if needed.

--no-progress
--max-concurrency 25
usernames.txt
--output lychee_report.txt
Copy link
Member Author

@waldyrious waldyrious Oct 31, 2025

Choose a reason for hiding this comment

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

I explicitly defined the output filename here, rather than let the action use the default one, since it's referenced further down in the workflow, and this way it is a bit clearer where it comes from.

- name: Update last report open issue created
if: ${{ env.lychee_exit_code != 0 }}
- name: Create or update username validation issue if there are errors
if: steps.lychee.outcome == 'failure'
Copy link
Member Author

Choose a reason for hiding this comment

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

Used the standard outcome field of GitHub Actions steps rather than relying on an a custom environment variable whose definition is hidden (and which is not even being used by the lychee action anymore).

Refactor the monthly username validation workflow for improved clarity and maintainability.

Also update lychee.md to the link to the CLI documentation page in the docs site.
@waldyrious waldyrious force-pushed the username-check-improvements branch from 9f056fc to 330d7c2 Compare October 31, 2025 20:16
@waldyrious
Copy link
Member Author

(I wanted to also rename the file from monthly-check.yml to monthly-username-check.yml, but then git/github stopped being able to recognize that it was the same file, and showed the diff as a deleted file and an added one. I might do that change in a separate PR.)

@waldyrious waldyrious marked this pull request as ready for review October 31, 2025 20:28
@waldyrious
Copy link
Member Author

Btw, the current workflow doesn't seem to be working correctly: the last run did fail to load some of the userpages (though for reasons other than them actually being invalid), but skipped the issue update steps, for reasons that are not clear to me.

Screenshot of the job log/output for future reference, since they will eventually be deleted:

image image

@kbdharun kbdharun added the hacktoberfest-accepted PRs that were opened for Hacktoberfest, but may not actually get merged until November. label Nov 1, 2025
Copy link
Member

@sbrl sbrl left a comment

Choose a reason for hiding this comment

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

Looks cool, and definitely improves maintainability here! Just thought I'd drop some comments while I'm thinking about it haha

workflow_dispatch:
schedule:
- cron: "0 0 1 * *"
- cron: "0 0 1 * *" # Run on the 1st of every month at midnight UTC
Copy link
Member

Choose a reason for hiding this comment

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

Offsetting this to a random value would be better practice, as if everyone does the same thing GitHub servers would be overwhelmed at the same time every month.

Hence perhaps do e.g. 1:24am or smth?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a strong opinion either way. I'll wait for others to chime in.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

mmmm true

it's just the sysadmin in me speaking haha

either way this is just a minor thing really

@sebastiaanspeck
Copy link
Member

Btw, the current workflow doesn't seem to be working correctly: the last run did fail to load some of the userpages (though for reasons other than them actually being invalid), but skipped the issue update steps, for reasons that are not clear to me.

Screenshot of the job log/output for future reference, since they will eventually be deleted:

image image

Could you test if this PR fixed the issue?

- name: Extract GitHub usernames for validation
run: |
{
grep -oP '@[\w-]+' .github/CODEOWNERS
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
grep -oP '@[\w-]+' .github/CODEOWNERS
grep -oP '@[\w-]+' .github/CODEOWNERS

Copy link
Member Author

Choose a reason for hiding this comment

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

I did it that way to make it more obvious that both patterns are looking for the same thing, with the only difference being the ** prefix in the second one. Do you think it makes it more confusing than helpful?

@waldyrious
Copy link
Member Author

Could you test if this PR fixed the issue?

Sure. How can I do that test? Maybe temporarily changing the triggering conditions of the workflow so it executes in this PR?

@sebastiaanspeck
Copy link
Member

Could you test if this PR fixed the issue?

Sure. How can I do that test? Maybe temporarily changing the triggering conditions of the workflow so it executes in this PR?

We do have workflow_dispatch already, so you can trigger it manually on this branch.

@waldyrious
Copy link
Member Author

Thanks! That seems to have done the trick: https://github.com/tldr-pages/tldr/actions/runs/19003751429/job/54274077842

I think I might change the action to add a comment to the issue instead of modifying the existing opening comment, to make the historical progression easier to follow.

Copy link
Member

@sbrl sbrl left a comment

Choose a reason for hiding this comment

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

Cool!

(take my time suggestion or leave it, it's p minor)

@kbdharun kbdharun changed the title monthly-check: Improve username validation workflow monthly-check: improve username validation workflow Nov 4, 2025
@sebastiaanspeck
Copy link
Member

Thanks! That seems to have done the trick: https://github.com/tldr-pages/tldr/actions/runs/19003751429/job/54274077842

I think I might change the action to add a comment to the issue instead of modifying the existing opening comment, to make the historical progression easier to follow.

I see we still have the issue about running into a 403 for 10 valid users. Are you able to fix that as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PRs that were opened for Hacktoberfest, but may not actually get merged until November. page edit Changes to an existing page(s). tooling Helper tools, scripts and automated processes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants