Create meeting template #2
This file contains hidden or 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: Create meeting template | |
| on: | |
| workflow_dispatch: {} | |
| schedule: | |
| # every week on tuesday at 10AM PST (with DST) | |
| - cron: '0 17 * * 2' | |
| jobs: | |
| create-discussion: | |
| permissions: | |
| discussions: write | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Check if it's an alternate week | |
| id: check-week | |
| run: | | |
| # Get ISO week number (1-53) | |
| WEEK_NUMBER=$(date +%V) | |
| # Check if week number is odd or even to run workflow and create agenda for next week's meeting | |
| if [ $((WEEK_NUMBER % 2)) -eq 0 ]; then | |
| echo "Should run this week (even week: $WEEK_NUMBER)" | |
| echo "should_run=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Skipping odd week: $WEEK_NUMBER" | |
| echo "should_run=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get agenda text from template | |
| if: steps.check-week.outputs.should_run == 'true' | |
| id: get-agenda | |
| run: | | |
| echo 'AGENDA<<EOF' >> $GITHUB_ENV | |
| cat .github/templates/agenda.md >> $GITHUB_ENV | |
| echo 'EOF' >> $GITHUB_ENV | |
| - name: Get Next Meeting Date | |
| if: steps.check-week.outputs.should_run == 'true' | |
| id: get-next-meeting-date | |
| run: | | |
| NEXT_MEETING_DATE=$(date -d "next Tuesday" +%Y-%m-%d) | |
| echo "NEXT_MEETING_DATE=$NEXT_MEETING_DATE" >> $GITHUB_ENV | |
| - name: Create discussion with agenda | |
| if: steps.check-week.outputs.should_run == 'true' | |
| id: create-repository-discussion | |
| uses: octokit/graphql-action@v2.x | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| variables: | | |
| body: "${{ env.AGENDA }}" | |
| title: "Overlays Meeting (${{ env.NEXT_MEETING_DATE }})" | |
| repositoryId: 'MDEwOlJlcG9zaXRvcnkzNTk4NjU5MDI=' | |
| categoryId: 'DIC_kwDOFXMeLs4COVB8' | |
| query: | | |
| mutation CreateDiscussionMutation ($title: String!, $body: String!, $repositoryId: ID!, $categoryId: ID!) { | |
| createDiscussion(input: { title: $title, body: $body, repositoryId: $repositoryId, categoryId: $categoryId }) { | |
| discussion { | |
| title | |
| } | |
| } | |
| } | |