Skip to content

Commit

Permalink
fix OCW workflows to run monthly
Browse files Browse the repository at this point in the history
  • Loading branch information
benjagm committed Sep 21, 2024
1 parent 4afc73d commit 491d69f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/ocwm-creator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Create OCWM Monthly

on:
schedule:
- cron: "0 9 15-21 * 2" # Runs at 9:00 AM on the 3rd Tuesday of the month
- cron: "0 9 * * 2" # Runs at 9:00 AM every Tuesday

repository_dispatch:
types: ocwm-creator
Expand Down Expand Up @@ -35,6 +35,26 @@ jobs:
date=$(date -u -d "6 days" +%Y-%m-%d)
echo "title=Open Community Working Meeting ${date} - 12:00 PT" >> "$GITHUB_OUTPUT"
# Step to check if it's the third Tuesday of the month
- name: Check if today is the third Tuesday
id: check-third-tuesday
run: |
day=$(date +%d)
dow=$(date +%u) # Day of the week (1 = Monday, ..., 7 = Sunday)
# Get the first day of this month
first_tuesday=$(cal | awk '/^..$/ {print $3}')
if [ "$dow" -ne 2 ]; then
echo "Not a Tuesday, exiting..."
exit 0
fi
# Calculate the third Tuesday by checking if the current date is between 15th and 21st
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
echo "This is the third Tuesday of the month!"
else
echo "Not the third Tuesday, exiting..."
exit 0
fi
- name: Create Issue using Template
id: create-issue
uses: peter-evans/create-issue-from-file@v5
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/ocwm-issue-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Search for issues and PR labeled 'agenda' and add them to the agenda

on:
schedule:
- cron: '0 0 8-14 * 0' # Runs at midnight on the second Sunday of the month
- cron: '0 1 * * 1' # Runs at 1:00 AM every Monday

repository_dispatch:
types: add-issues-ocwm
Expand All @@ -26,6 +26,25 @@ jobs:

- name: Install dependencies
run: npm install @octokit/core@5.1.0

# Step to check if today is the third Monday
- name: Check if today is the third Monday
id: check-third-monday
run: |
day=$(date +%d)
dow=$(date +%u) # Day of the week (1 = Monday, ..., 7 = Sunday)
# Check if the day is between 15th and 21st, and if it's Monday (1)
if [ "$dow" -ne 1 ]; then
echo "Not a Monday, exiting..."
exit 0
fi
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
echo "This is the third Monday of the month!"
else
echo "Not the third Monday, exiting..."
exit 0
fi
- name: Adding Issues
id: add-issues
uses: actions/github-script@v7
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ocwm-reminders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ jobs:
- name: Install dependencies
run: npm install @octokit/core@5.1.0

# Step to check if today is the third Monday
- name: Check if today is the third Monday
id: check-third-monday
run: |
day=$(date +%d)
dow=$(date +%u) # Day of the week (1 = Monday, ..., 7 = Sunday)
# Check if the day is between 15th and 21st, and if it's Monday (1)
if [ "$dow" -ne 1 ]; then
echo "Not a Monday, exiting..."
exit 0
fi
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
echo "This is the third Monday of the month!"
else
echo "Not the third Monday, exiting..."
exit 0
fi
- name: Send reminders
uses: actions/github-script@v7
env:
Expand Down

0 comments on commit 491d69f

Please sign in to comment.