Meeting Notes - Agenda Open #31
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
# This workflow creates a GitHub issue from a template config file. | |
# It sends a message to a Slack webhook url if configured. | |
name: Meeting Notes - Agenda Open | |
on: | |
workflow_dispatch: | |
schedule: | |
# https://crontab.guru/#0_15_*_*_4 "At 15:00 on Thursday." | |
- cron: '0 15 * * 4' | |
jobs: | |
create_and_notify: | |
permissions: | |
issues: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fortnightly check | |
id: fortnightly | |
if: ${{ vars.FORTNIGHTLY == 'true' }} | |
run: echo "execute=$(expr $(date +%W) % ${PARITY})" >> $GITHUB_OUTPUT | |
env: | |
# values: (1,2) | |
# 1 - runs on odd week numbers | |
# 2 - runs on even week numbers | |
PARITY: ${{ vars.FORTNIGHTLY_PARITY }} | |
# Uses the ./config/meeting_minutes_template.md as a template | |
- name: Create a new issue from template | |
id: new_issue | |
if: vars.FORTNIGHTLY != 'true' || steps.fortnightly.outputs.execute == 0 | |
env: | |
GH_TOKEN: ${{ github.token }} # needed for GitHub CLI | |
# After creating the issue it sets the url as a step output | |
run: | | |
echo "url=$(gh issue create --title "$(date +'%Y-%m-%d') - Meeting Minutes" --body-file ./config/meeting_minutes_template.md | grep -Eo 'https:\/\/github\.com.*')" >> $GITHUB_OUTPUT | |
# Uses a slack workflow webhook to send a custom message | |
# using the a json config file at config/messages as a template. | |
# Replaces the URL and MEETING_NAME variables and send it to Slack | |
- name: Send custom JSON data to Slack workflow | |
if: env.SLACK_WEBHOOK_URL && env.MEETING_NAME && env.URL | |
run: | | |
jq --arg URL "$URL" --arg NAME "$MEETING_NAME" \ | |
'.body |= sub("\\$URL";$URL) | .body |= sub("\\$NAME";$NAME)' \ | |
config/messages/agenda_open.json |\ | |
curl -d @- -H "Content-Type: application/json" $SLACK_WEBHOOK_URL | |
env: | |
MEETING_NAME: ${{ vars.MEETING_NAME }} | |
URL: ${{ steps.new_issue.outputs.url }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |