Skip to content

Commit 2f29f31

Browse files
committed
Add a slack notification to remind the Android team about the merge day
1 parent 04a57fe commit 2f29f31

2 files changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Fenix beta cut Slack announcement
2+
3+
on:
4+
schedule:
5+
# Runs once a day at 12:00 UTC, which is 8am Eastern for the eight months
6+
# of the year Eastern is on daylight saving, and 7am for the rest: cron has
7+
# no time zone, so one of the two has to drift.
8+
#
9+
# Ahead of the 16:00 UTC merge on purpose: the version bump lands during
10+
# merge day, and after that the API's "nightly" is the next major, not the
11+
# one merging today.
12+
- cron: '0 12 * * *'
13+
workflow_dispatch:
14+
inputs:
15+
dry_run:
16+
description: 'Print the message instead of posting it to Slack'
17+
required: false
18+
type: boolean
19+
default: true
20+
test_date:
21+
description: 'Pretend today is this date (YYYY-MM-DD), e.g. 2026-08-27'
22+
required: false
23+
type: string
24+
25+
jobs:
26+
announce:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 30
29+
permissions:
30+
contents: read
31+
steps:
32+
- uses: actions/checkout@v5
33+
with:
34+
persist-credentials: false
35+
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.12'
39+
40+
- name: Announce the Fenix beta cut if today is the Nightly merge day
41+
env:
42+
SLACK_WEBHOOK_URL: ${{ secrets.MOBILE_ANDROID_TEAM_SLACK_WEBHOOK }}
43+
DRY_RUN: ${{ inputs.dry_run }}
44+
TEST_DATE: ${{ inputs.test_date }}
45+
run: python3 app/scripts/fenix_beta_cut_slack_notifier.py
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Announces the Fenix beta cut in #mobile-android-team on desktop merge day.
4+
5+
Run daily by .github/workflows/fenix-beta-cut-slack.yml. It reads the current
6+
Nightly's schedule and posts only when today is that version's merge day, so it is
7+
safe to run every day of the year.
8+
9+
The run is deliberately scheduled ahead of the merge. The version bump
10+
lands during merge day itself, and once it has, "nightly" answers with the next
11+
major, whose merge day is a fortnight away. Asking before the merge gets the version
12+
that is merging today.
13+
14+
Requires the SLACK_WEBHOOK_URL environment variable (set from the
15+
MOBILE_ANDROID_TEAM_SLACK_WEBHOOK repo secret in the workflow, named for the
16+
#mobile-android-team channel it posts to).
17+
18+
Env vars for testing:
19+
DRY_RUN=1 print the message instead of posting it. Accepts
20+
1/true/yes/on to enable and 0/false/no/off or empty to
21+
disable; anything else is an error rather than a guess.
22+
TEST_DATE=Y-m-d pretend today is this date, to exercise a merge day that
23+
isn't today (e.g. 2026-08-27)
24+
"""
25+
import os
26+
import sys
27+
from datetime import datetime
28+
29+
from lib.env import env_flag
30+
from lib.schedule import fetch_schedule, parse_date, today as utc_today
31+
from lib.slack import post_to_slack
32+
33+
# Slack has no list markdown — a literal bullet character is how you get a list.
34+
MESSAGE = (
35+
"*Fenix Beta Cut Time*\n"
36+
"Today is the <https://whattrainisitnow.com/release/?version={version}|FX{version}> "
37+
"merge day. Later today, release management will merge main to beta, and then bump main to "
38+
"{next_version}.\n"
39+
"• Who's responsible? Check <https://www.whoisdoingwhat.dev/|here> to see which "
40+
"squad is assigned.\n"
41+
"• Taking on the starting the nightly Fx{next_version} development cycle? Please "
42+
"leave a message here to let others know.\n"
43+
"• Need instructions? Find them <https://firefox-source-docs.mozilla.org/mobile/"
44+
"android/fenix/release-checklist.html|here>."
45+
)
46+
47+
48+
def main() -> int:
49+
dry_run = env_flag("DRY_RUN")
50+
webhook_url = os.environ.get("SLACK_WEBHOOK_URL")
51+
if not webhook_url and not dry_run:
52+
print("SLACK_WEBHOOK_URL is not set — nothing to do.", file=sys.stderr)
53+
return 1
54+
55+
test_date = os.environ.get("TEST_DATE")
56+
if test_date:
57+
today = datetime.strptime(test_date, "%Y-%m-%d").date()
58+
print(f"TEST MODE: pretending today is {today}")
59+
else:
60+
today = utc_today()
61+
62+
schedule = fetch_schedule("nightly")
63+
merge_day = parse_date(schedule["merge_day"])
64+
if today != merge_day:
65+
print(f"{today}: not merge day (next one is {merge_day}). Nothing to post.")
66+
return 0
67+
68+
# "156.0" -> 156: the message talks about the major, not the build.
69+
version = int(schedule["version"].split(".")[0])
70+
text = MESSAGE.format(version=version, next_version=version + 1)
71+
72+
if dry_run:
73+
print(f"DRY RUN — would post:\n{text}")
74+
return 0
75+
76+
post_to_slack(webhook_url, text)
77+
print(f"{today}: posted the Fenix beta cut announcement for Firefox {version}.")
78+
return 0
79+
80+
81+
if __name__ == "__main__":
82+
raise SystemExit(main())

0 commit comments

Comments
 (0)