-
Notifications
You must be signed in to change notification settings - Fork 37
Simplify cron for checking to see if its the conda-forge wednesday #101
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,29 +37,30 @@ jobs: | |
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.10' | ||
| - name: Install dateutil | ||
| if: github.event_name == 'schedule' | ||
| run: python -m pip install python-dateutil | ||
| - name: Check if we need to run this week | ||
| if: github.event_name == 'schedule' | ||
| id: check-wednesday | ||
| shell: python | ||
| run: | | ||
| import os | ||
| from datetime import datetime | ||
| from dateutil.rrule import rrule, WEEKLY, WE | ||
| today = datetime.today() | ||
| print("Today is", today) | ||
| every_two_wednesdays = rrule(WEEKLY, interval=2, dtstart=datetime(2023, 3, 15), wkst=WE) | ||
| for wednesday in every_two_wednesdays: | ||
| print("Testing if today matches...", wednesday) | ||
| if wednesday.date() == today.date(): | ||
| print("Match! Job should run.") | ||
| import datetime, sys | ||
| year, week, weekday = dt.isocalendar() | ||
| print(f'{year=}, {week=}, {weekday=}') | ||
| # Wednesday is the third day of the week | ||
| not_wednesday = weekday != 3 | ||
| if not_wednesday: | ||
| # exit the script | ||
| sys.exit(0) | ||
| else: | ||
| # then it's Wednesday! | ||
| print("it's Wednesday!") | ||
| if week % 2 == 0: | ||
| # conda forge meeting on even weeks | ||
| print("conda-forge meeting match! Job should run.") | ||
| with open(os.environ['GITHUB_ENV'], 'a') as f: | ||
| print("should_run=yes", f) | ||
| elif wednesday > today: | ||
| print("Didn't match. Aborting.") | ||
| break | ||
| else: | ||
| # conda community meeting on odd weeks | ||
| print('conda community meeting!') | ||
|
Comment on lines
+56
to
+63
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, I checked and we do:
So for this repo we need to reverse the logic, but for conda-forge we need to migrate it. The problem is that we have been creating the meeting notes with some days in advance now (sometimes as soon as the meeting was over), so we need to do the check not for "today" but for the next even Wednesday. So all in all I feel that this daily logic is not serving the community needs anymore. We probably need something like: |
||
| - name: Set output | ||
| id: return-value | ||
| run: | | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean this, right?