Skip to content

Commit 3a924ea

Browse files
committed
Fix the conditions to run the OCWM workflows monthly
1 parent 491d69f commit 3a924ea

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.github/workflows/ocwm-creator.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ jobs:
2929
uses: actions/setup-python@v5
3030
with:
3131
python-version: '3.8'
32+
3233
- name: Generate Issue Title
3334
id: create-title
3435
run: |
35-
date=$(date -u -d "6 days" +%Y-%m-%d)
36-
echo "title=Open Community Working Meeting ${date} - 12:00 PT" >> "$GITHUB_OUTPUT"
36+
# Get the first day of the next month
37+
next_month=$(date -u -d "$(date +%Y-%m-01) +1 month" +%Y-%m-01)
38+
39+
# Find the first Monday of the next month
40+
first_monday=$(date -u -d "$next_month +$(( (8 - $(date -u -d "$next_month" +%u)) % 7 )) days" +%Y-%m-%d)
41+
42+
# Calculate the third Monday by adding 14 days to the first Monday
43+
third_monday=$(date -u -d "$first_monday +14 days" +%Y-%m-%d)
44+
45+
# Output the issue title with the third Monday's date
46+
echo "title=Open Community Working Meeting ${third_monday} - 12:00 PT" >> "$GITHUB_OUTPUT"
3747
3848
# Step to check if it's the third Tuesday of the month
3949
- name: Check if today is the third Tuesday
@@ -45,18 +55,22 @@ jobs:
4555
first_tuesday=$(cal | awk '/^..$/ {print $3}')
4656
if [ "$dow" -ne 2 ]; then
4757
echo "Not a Tuesday, exiting..."
58+
echo "::set-output name=is-third-tuesday::false"
4859
exit 0
4960
fi
5061
# Calculate the third Tuesday by checking if the current date is between 15th and 21st
5162
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
5263
echo "This is the third Tuesday of the month!"
64+
echo "::set-output name=is-third-tuesday::true"
5365
else
5466
echo "Not the third Tuesday, exiting..."
67+
echo "::set-output name=is-third-tuesday::false"
5568
exit 0
5669
fi
5770
5871
- name: Create Issue using Template
5972
id: create-issue
73+
if: steps.check-third-tuesday.outputs.is-third-tuesday == 'true'
6074
uses: peter-evans/create-issue-from-file@v5
6175
with:
6276
title: ${{ steps.create-title.outputs.title }}

.github/workflows/ocwm-issue-collector.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,21 @@ jobs:
3636
# Check if the day is between 15th and 21st, and if it's Monday (1)
3737
if [ "$dow" -ne 1 ]; then
3838
echo "Not a Monday, exiting..."
39+
echo "::set-output name=is-third-monday::false"
3940
exit 0
4041
fi
4142
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
4243
echo "This is the third Monday of the month!"
44+
echo "::set-output name=is-third-monday::true"
4345
else
4446
echo "Not the third Monday, exiting..."
47+
echo "::set-output name=is-third-monday::false"
4548
exit 0
4649
fi
4750
4851
- name: Adding Issues
4952
id: add-issues
53+
if: steps.check-third-monday.outputs.is-third-monday == 'true'
5054
uses: actions/github-script@v7
5155
env:
5256
PLACEHOLDER: '<!-- | [TOPIC] [IssuePRDiscussion] | [owner] | -->'

.github/workflows/ocwm-reminders.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,20 @@ jobs:
3737
# Check if the day is between 15th and 21st, and if it's Monday (1)
3838
if [ "$dow" -ne 1 ]; then
3939
echo "Not a Monday, exiting..."
40+
echo "::set-output name=is-third-monday::false"
4041
exit 0
4142
fi
4243
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
4344
echo "This is the third Monday of the month!"
45+
echo "::set-output name=is-third-monday::true"
4446
else
4547
echo "Not the third Monday, exiting..."
48+
echo "::set-output name=is-third-monday::false"
4649
exit 0
4750
fi
4851
4952
- name: Send reminders
53+
if: steps.check-third-monday.outputs.is-third-monday == 'true'
5054
uses: actions/github-script@v7
5155
env:
5256
MY_TOKEN: ${{ steps.get_workflow_token.outputs.token }}

0 commit comments

Comments
 (0)