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

Fix the conditions to run the OCWM workflows monthly #808

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/ocwm-creator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,21 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Generate Issue Title
id: create-title
run: |
date=$(date -u -d "6 days" +%Y-%m-%d)
echo "title=Open Community Working Meeting ${date} - 12:00 PT" >> "$GITHUB_OUTPUT"
# Get the first day of the next month
next_month=$(date -u -d "$(date +%Y-%m-01) +1 month" +%Y-%m-01)
# Find the first Monday of the next month
first_monday=$(date -u -d "$next_month +$(( (8 - $(date -u -d "$next_month" +%u)) % 7 )) days" +%Y-%m-%d)
# Calculate the third Monday by adding 14 days to the first Monday
third_monday=$(date -u -d "$first_monday +14 days" +%Y-%m-%d)
# Output the issue title with the third Monday's date
echo "title=Open Community Working Meeting ${third_monday} - 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
Expand All @@ -45,18 +55,22 @@ jobs:
first_tuesday=$(cal | awk '/^..$/ {print $3}')
if [ "$dow" -ne 2 ]; then
echo "Not a Tuesday, exiting..."
echo "::set-output name=is-third-tuesday::false"
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!"
echo "::set-output name=is-third-tuesday::true"
else
echo "Not the third Tuesday, exiting..."
echo "::set-output name=is-third-tuesday::false"
exit 0
fi
- name: Create Issue using Template
id: create-issue
if: steps.check-third-tuesday.outputs.is-third-tuesday == 'true'
uses: peter-evans/create-issue-from-file@v5
with:
title: ${{ steps.create-title.outputs.title }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ocwm-issue-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ jobs:
# 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..."
echo "::set-output name=is-third-monday::false"
exit 0
fi
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
echo "This is the third Monday of the month!"
echo "::set-output name=is-third-monday::true"
else
echo "Not the third Monday, exiting..."
echo "::set-output name=is-third-monday::false"
exit 0
fi
- name: Adding Issues
id: add-issues
if: steps.check-third-monday.outputs.is-third-monday == 'true'
uses: actions/github-script@v7
env:
PLACEHOLDER: '<!-- | [TOPIC] [IssuePRDiscussion] | [owner] | -->'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ocwm-reminders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ jobs:
# 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..."
echo "::set-output name=is-third-monday::false"
exit 0
fi
if [ "$day" -ge 15 ] && [ "$day" -le 21 ]; then
echo "This is the third Monday of the month!"
echo "::set-output name=is-third-monday::true"
else
echo "Not the third Monday, exiting..."
echo "::set-output name=is-third-monday::false"
exit 0
fi
- name: Send reminders
if: steps.check-third-monday.outputs.is-third-monday == 'true'
uses: actions/github-script@v7
env:
MY_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
Expand Down