Monthly Meeting Reminder #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Monthly Meeting Reminder | |
on: | |
schedule: | |
- cron: '0 0 23 * *' # Run on the 23rd of every month at 00:00 UTC | |
workflow_dispatch: | |
jobs: | |
create-issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get next meeting date | |
id: next-meeting | |
run: | | |
next_month=$(date -d 'next month' +'%Y-%m-01') | |
day=$(date -d "$next_month" +'%Y-%m-%d') | |
day_of_week=$(date -d "$day" +'%u') # 1 = Monday, 7 = Sunday | |
if [ "$day_of_week" -eq 3 ]; then | |
echo "::set-output name=date::$day" | |
else | |
days_to_add=$(( 3 - day_of_week + 7 )) | |
echo "::set-output name=date::$(date -d "$day +$days_to_add days" +'%Y-%m-%d')" | |
fi | |
- name: Create monthly meeting issue | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: Meeting [${{ steps.next-meeting.outputs.date }}] | |
content-filepath: ./Meeting.md | |
labels: meeting |