Community Call Reminder #3
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: Community Call Reminder | |
| on: | |
| schedule: | |
| # Every Tuesday at 00:00 UTC = 08:00 HKT (2 hours before 10:00 HKT call) | |
| - cron: '0 0 * * 2' | |
| workflow_dispatch: # Manual trigger for testing | |
| jobs: | |
| post-reminder: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Collect agenda from project board | |
| id: agenda | |
| env: | |
| GH_TOKEN: ${{ secrets.PROJECT_READ_TOKEN }} | |
| run: | | |
| # Fetch issues in "Review pool", "Final review", and "Ready" columns | |
| QUERY='query { | |
| node(id: "PVT_kwDOBrtarc4BRNVy") { | |
| ... on ProjectV2 { | |
| items(first: 50) { | |
| nodes { | |
| fieldValueByName(name: "Status") { | |
| ... on ProjectV2ItemFieldSingleSelectValue { name } | |
| } | |
| content { | |
| ... on Issue { | |
| title number url | |
| labels(first: 5) { nodes { name } } | |
| author { login } | |
| } | |
| ... on PullRequest { | |
| title number url | |
| labels(first: 5) { nodes { name } } | |
| author { login } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }' | |
| RESULT=$(gh api graphql -f query="$QUERY") | |
| # Build agenda sections | |
| build_section() { | |
| local status="$1" | |
| local header="$2" | |
| local items | |
| items=$(echo "$RESULT" | jq -r --arg s "$status" ' | |
| .data.node.items.nodes[] | |
| | select(.fieldValueByName.name == $s) | |
| | select(.content != null) | |
| | "- [#\(.content.number)](\(.content.url)) \(.content.title) (by @\(.content.author.login))" | |
| ') | |
| if [ -n "$items" ]; then | |
| echo "**$header:**" | |
| echo "$items" | |
| echo "" | |
| fi | |
| } | |
| { | |
| echo 'AGENDA<<EOF' | |
| build_section "Review pool" "Ready for review" | |
| build_section "Final review" "Final review" | |
| build_section "Ready" "Up next" | |
| echo 'EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Post to Zulip | |
| env: | |
| ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} | |
| ZULIP_BOT_API_KEY: ${{ secrets.ZULIP_BOT_API_KEY }} | |
| run: | | |
| TODAY=$(TZ=Asia/Hong_Kong date +%Y-%m-%d) | |
| CALL_TIME="10:00 HKT (UTC+8)" | |
| TOPIC="Community Call ${TODAY}" | |
| BODY="**Community Call — ${TODAY} at ${CALL_TIME}** | |
| **Join:** ${{ secrets.CALL_LINK }} | |
| ## Agenda | |
| ${{ steps.agenda.outputs.AGENDA }} | |
| **Open discussion** — bring your questions and ideas! | |
| --- | |
| _Reply to this thread to add agenda items._" | |
| # Post via Zulip API | |
| curl -s -X POST "https://problem-reductions.zulipchat.com/api/v1/messages" \ | |
| -u "${ZULIP_BOT_EMAIL}:${ZULIP_BOT_API_KEY}" \ | |
| --data-urlencode "type=stream" \ | |
| --data-urlencode "to=community-call" \ | |
| --data-urlencode "topic=${TOPIC}" \ | |
| --data-urlencode "content=${BODY}" |