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

Improve outdated tutorials check #1021

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jooola
Copy link
Contributor

@jooola jooola commented Dec 10, 2024

  • Extract summary building in a script that can be run locally
  • Include the date of the tutorials in the summary table
  • Add the year to the created issue title
  • Test the workflow when files are changed in a pull_request

Comment on lines +6 to +15
pull_request:
branches: [master]
paths:
- .github/workflows/outdated-tutorials.yml
- hack/outdated-tutorials-summary.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allows the workflow to run on pull request, so we can test changes.

hack/outdated-tutorials-summary.sh | tee summary.md $GITHUB_STEP_SUMMARY

- name: Create issue
if: github.event_name == 'schedule'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only create an issue if the workflow is run from a schedule, since we only want to test the summary generation in pull requests.

- Extract summary building in a script that can be run locally
- Include the date of the tutorials in the summary table
- Add the year to the created issue title
- Test the workflow when files are changed in a pull_request
@wpdevelopment11
Copy link
Contributor

wpdevelopment11 commented Dec 14, 2024

If you run outdated-tutorials-summary.sh on the first day of the month using cron:

schedule:
- cron: "0 0 1 * *"

then tutorials written in the previous year, but not on the first day of the month will not be present in the table. You will need to wait two years to review them.

This condition will be false, because their timestamps will be bigger:

if [[ "$last_year_timestamp" -ge "$date_timestamp" && "$last_year_month" == "$date_month" ]]; then

To reproduce, replace:

  • last_year_timestamp=$(date +'%s' -d '1 year ago') with last_year_timestamp=$(date +'%s' -d '2023-12-01 00:00:00')
  • last_year_month=$(date +'%m' -d '1 year ago') with last_year_month=12

This tutorial will not be present.

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.

2 participants