Skip to content

Commit 2a2f2e1

Browse files
authored
Automate weekly call agendas (#28)
Signed-off-by: Carrie Dils <[email protected]> Signed-off-by: Carrie Dils <[email protected]>
1 parent fac77eb commit 2a2f2e1

File tree

2 files changed

+123
-14
lines changed

2 files changed

+123
-14
lines changed

.github/workflows/create-tech-call-discussion.yml

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Create FAIR Tech Call Weekly Discussion
22

33
on:
4-
workflow_dispatch:
4+
workflow_dispatch: # Manual runs with optional date override
5+
inputs:
6+
meeting_date:
7+
description: 'Meeting date (YYYY-MM-DD). If omitted, uses next Monday.'
8+
required: false
59
schedule:
6-
- cron: '30 17 * * 0' # Every Sunday at 17:30 UTC
10+
- cron: '35 18 * * 1' # Every Monday at 18:35 UTC (post next week's agenda)
711

812
permissions:
913
contents: read
@@ -15,16 +19,49 @@ jobs:
1519
- name: Set up dynamic values
1620
id: vars
1721
run: |
18-
# Target tomorrow (Monday) for meeting date
19-
MEETING_DATE=$(date -u -d "tomorrow" +'%Y-%m-%d')
20-
DISPLAY_DATE=$(date -u -d "tomorrow" +'%B %d, %Y')
22+
# Use manual date if provided; otherwise default to NEXT Monday.
23+
if [ -n "${{ github.event.inputs.meeting_date }}" ]; then
24+
MEETING_DATE="${{ github.event.inputs.meeting_date }}"
25+
else
26+
MEETING_DATE=$(date -u -d "next monday" +'%Y-%m-%d')
27+
fi
28+
29+
DISPLAY_DATE=$(date -u -d "$MEETING_DATE" +'%B %d, %Y')
2130
TZ_LINK="https://www.timeanddate.com/worldclock/fixedtime.html?iso=${MEETING_DATE//-}T1730"
2231
2332
echo "date_slug=$MEETING_DATE" >> $GITHUB_OUTPUT
2433
echo "date_display=$DISPLAY_DATE" >> $GITHUB_OUTPUT
2534
echo "tz_link=$TZ_LINK" >> $GITHUB_OUTPUT
2635
36+
- name: Check for existing discussion
37+
id: check_existing
38+
env:
39+
GH_TOKEN: ${{ secrets.DISCUSSION_PAT }}
40+
run: |
41+
TITLE="Tech Call Agenda - ${{ steps.vars.outputs.date_slug }}"
42+
Q="repo:fairpm/tsc is:discussion in:title \"$TITLE\""
43+
RESP=$(gh api graphql -f query='
44+
query($q:String!) {
45+
search(query:$q, type: DISCUSSION, first: 1) {
46+
discussionCount
47+
edges { node { ... on Discussion { title url } } }
48+
}
49+
}' -f q="$Q")
50+
COUNT=$(echo "$RESP" | jq -r '.data.search.discussionCount')
51+
if [ "$COUNT" -gt 0 ]; then
52+
URL=$(echo "$RESP" | jq -r '.data.search.edges[0].node.url')
53+
echo "found=true" >> "$GITHUB_OUTPUT"
54+
echo "existing_url=$URL" >> "$GITHUB_OUTPUT"
55+
echo "Found existing discussion: $URL"
56+
else
57+
echo "found=false" >> "$GITHUB_OUTPUT"
58+
echo "existing_url=" >> "$GITHUB_OUTPUT"
59+
echo "No existing discussion found for: $TITLE"
60+
fi
61+
2762
- name: Create GitHub Discussion
63+
if: ${{ steps.check_existing.outputs.found != 'true' }}
64+
id: create_discussion
2865
uses: abirismyname/[email protected]
2966
with:
3067
github-token: ${{ secrets.DISCUSSION_PAT }}
@@ -40,7 +77,7 @@ jobs:
4077
4178
## Meeting details
4279
* Meeting is ${{ steps.vars.outputs.date_display }} – 17:30 UTC ([see it in your time zone](${{ steps.vars.outputs.tz_link }}))
43-
* [Link to Meeting Calendar](https://zoom-lfx.platform.linuxfoundation.org/meeting/95837337329?password=fd00a64e-3e89-49a9-9827-17f381443a7c)
80+
* [Link to Meeting Calendar](https://zoom-lfx.platform.linuxfoundation.org/meeting/98982564470?password=5143c55f-4b07-4914-9666-cc55daca752d)
4481
4582
## How to join
4683
This call is open to anyone, but note that you need to have a profile/account at [OpenProfile.dev](https://openprofile.dev/) to join the call.
@@ -50,3 +87,21 @@ jobs:
5087
FAIR is part of the Linux Foundation. Meeting attendees are subject to both the [Code of Conduct](https://github.com/fairpm/tsc/blob/main/code-of-conduct.md) and the [LF Antitrust Policy](https://www.linuxfoundation.org/legal/antitrust-policy).
5188
5289
This meeting is recorded and publicly available via your OpenProfile.dev account.
90+
91+
- name: Skip creation (already exists)
92+
if: ${{ steps.check_existing.outputs.found == 'true' }}
93+
run: echo "Discussion already exists: ${{ steps.check_existing.outputs.existing_url }} — skipping creation."
94+
95+
- name: Announce in Slack (success only)
96+
if: ${{ steps.check_existing.outputs.found != 'true' && steps.create_discussion.outcome == 'success' && steps.create_discussion.outputs.discussion-url != '' }}
97+
env:
98+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_FAIR_MEETING_ANNOUNCER }}
99+
run: |
100+
payload=$(jq -n \
101+
--arg text ":spiral_calendar_pad: *Tech Call Agenda Posted*\n*Date:* ${{ steps.vars.outputs.date_display }} (17:30 UTC)\n:link: <${{ steps.create_discussion.outputs.discussion-url }}|View agenda>\n:earth_americas: <${{ steps.vars.outputs.tz_link }}|See in your timezone>" \
102+
'{text: $text}')
103+
curl -sS -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL"
104+
105+
- name: Skip Slack notification
106+
if: ${{ !(steps.check_existing.outputs.found != 'true' && steps.create_discussion.outcome == 'success' && steps.create_discussion.outputs.discussion-url != '') }}
107+
run: echo "Skipping Slack — duplicate or creation failed."

.github/workflows/create-tsc-call-discussion.yml

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
name: Create FAIR TSC Weekly Discussion
1+
name: Create FAIR TSC General Weekly Discussion
22

33
on:
4-
workflow_dispatch: # Allows manual runs
4+
workflow_dispatch: # Manual runs with optional date override
5+
inputs:
6+
meeting_date:
7+
description: 'Meeting date (YYYY-MM-DD). If omitted, uses next Thursday.'
8+
required: false
59
schedule:
6-
- cron: '0 19 * * 3' # Every Wednesday at 19:00 UTC
10+
- cron: '5 20 * * 4' # Every Thursday at 20:05 UTC (post next week's agenda)
711

812
permissions:
9-
contents: read # Needed for repo access, even though we're using a PAT
13+
contents: read
1014

1115
jobs:
1216
post-weekly-discussion:
@@ -15,22 +19,54 @@ jobs:
1519
- name: Set up dynamic values
1620
id: vars
1721
run: |
18-
# Target next day (Thursday) for meeting date
19-
MEETING_DATE=$(date -u -d "tomorrow" +'%Y-%m-%d')
20-
DISPLAY_DATE=$(date -u -d "tomorrow" +'%B %d, %Y')
22+
# Use manual date if provided; otherwise default to NEXT Thursday.
23+
if [ -n "${{ github.event.inputs.meeting_date }}" ]; then
24+
MEETING_DATE="${{ github.event.inputs.meeting_date }}"
25+
else
26+
MEETING_DATE=$(date -u -d "next thursday" +'%Y-%m-%d')
27+
fi
28+
29+
DISPLAY_DATE=$(date -u -d "$MEETING_DATE" +'%B %d, %Y')
2130
TZ_LINK="https://www.timeanddate.com/worldclock/fixedtime.html?iso=${MEETING_DATE//-}T1900"
2231
2332
echo "date_slug=$MEETING_DATE" >> $GITHUB_OUTPUT
2433
echo "date_display=$DISPLAY_DATE" >> $GITHUB_OUTPUT
2534
echo "tz_link=$TZ_LINK" >> $GITHUB_OUTPUT
2635
36+
- name: Check for existing discussion
37+
id: check_existing
38+
env:
39+
GH_TOKEN: ${{ secrets.DISCUSSION_PAT }}
40+
run: |
41+
TITLE="TSC General Meeting Agenda - ${{ steps.vars.outputs.date_slug }}"
42+
Q="repo:fairpm/tsc is:discussion in:title \"$TITLE\""
43+
RESP=$(gh api graphql -f query='
44+
query($q:String!) {
45+
search(query:$q, type: DISCUSSION, first: 1) {
46+
discussionCount
47+
edges { node { ... on Discussion { title url } } }
48+
}
49+
}' -f q="$Q")
50+
COUNT=$(echo "$RESP" | jq -r '.data.search.discussionCount')
51+
if [ "$COUNT" -gt 0 ]; then
52+
URL=$(echo "$RESP" | jq -r '.data.search.edges[0].node.url')
53+
echo "found=true" >> "$GITHUB_OUTPUT"
54+
echo "existing_url=$URL" >> "$GITHUB_OUTPUT"
55+
echo "Found existing discussion: $URL"
56+
else
57+
echo "found=false" >> "$GITHUB_OUTPUT"
58+
echo "existing_url=" >> "$GITHUB_OUTPUT"
59+
echo "No existing discussion found for: $TITLE"
60+
fi
61+
2762
- name: Create GitHub Discussion
63+
if: ${{ steps.check_existing.outputs.found != 'true' }}
64+
id: create_discussion
2865
uses: abirismyname/[email protected]
2966
with:
3067
github-token: ${{ secrets.DISCUSSION_PAT }}
3168
repository-name: fairpm/tsc
3269
category-name: General
33-
3470
title: "TSC General Meeting Agenda - ${{ steps.vars.outputs.date_slug }}"
3571
body: |
3672
**Meeting Purpose:** Strategic direction, governance, policy, cross-team priorities, and project oversight.
@@ -51,3 +87,21 @@ jobs:
5187
FAIR is part of the Linux Foundation. Meeting attendees are subject to both the [Code of Conduct](https://github.com/fairpm/tsc/blob/main/code-of-conduct.md) and the [LF Antitrust Policy](https://www.linuxfoundation.org/legal/antitrust-policy).
5288
5389
This meeting is recorded and publicly available via your OpenProfile.dev account.
90+
91+
- name: Skip creation (already exists)
92+
if: ${{ steps.check_existing.outputs.found == 'true' }}
93+
run: echo "Discussion already exists: ${{ steps.check_existing.outputs.existing_url }} — skipping creation."
94+
95+
- name: Announce in Slack (success only)
96+
if: ${{ steps.check_existing.outputs.found != 'true' && steps.create_discussion.outcome == 'success' && steps.create_discussion.outputs.discussion-url != '' }}
97+
env:
98+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_FAIR_MEETING_ANNOUNCER }}
99+
run: |
100+
payload=$(jq -n \
101+
--arg text ":spiral_calendar_pad: *TSC General Meeting Agenda Posted*\n*Date:* ${{ steps.vars.outputs.date_display }} (19:00 UTC)\n:link: <${{ steps.create_discussion.outputs.discussion-url }}|View agenda>\n:earth_americas: <${{ steps.vars.outputs.tz_link }}|See in your timezone>" \
102+
'{text: $text}')
103+
curl -sS -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL"
104+
105+
- name: Skip Slack notification
106+
if: ${{ !(steps.check_existing.outputs.found != 'true' && steps.create_discussion.outcome == 'success' && steps.create_discussion.outputs.discussion-url != '') }}
107+
run: echo "Skipping Slack — duplicate or creation failed."

0 commit comments

Comments
 (0)