Skip to content

Commit f3c143a

Browse files
ci: zulip emoji reconciliation sweep (#41852)
This PR adds a workflow that uses the action added in leanprover-community/mathlib-ci#53 to ensure that zulip emoji reactions do not become stale. (See the [docs](https://github.com/leanprover-community/mathlib-ci/blob/master/docs/zulip-emoji-reconcile.md) for more detail.) This action has been tested on the `ci-dev/zulip-emoji-reconcile` branch, which led to some fixes getting merged in leanprover-community/mathlib-ci#61. (See that PR for links to the specific workflow runs.) In a later PR we will replace the existing legacy zulip emoji reaction workflows with additional `pull_request`, `workflow_run`, etc. triggers on this workflow. Generated with Claude code.
1 parent fe1bd79 commit f3c143a

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Periodic safety net that keeps the Zulip emoji reactions on PR-related messages
2+
# in sync with each PR's actual state (open/closed/merged, labels, CI result).
3+
# The event-driven zulip_emoji_* workflows react to individual label/close/CI
4+
# events; this sweep repairs any drift they miss (dropped webhooks, outages,
5+
# state changes while a workflow was broken). See
6+
# https://github.com/leanprover-community/mathlib-ci/blob/master/docs/zulip-emoji-reconcile.md
7+
name: Zulip emoji reconcile
8+
9+
on:
10+
schedule:
11+
- cron: "37 * * * *" # hourly, offset to dodge top-of-hour runner load
12+
workflow_dispatch:
13+
inputs:
14+
dry-run:
15+
description: Log planned reaction changes without modifying Zulip
16+
type: boolean
17+
default: false
18+
19+
concurrency:
20+
group: ${{ github.workflow }}
21+
cancel-in-progress: false
22+
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
jobs:
28+
reconcile:
29+
if: github.repository == 'leanprover-community/mathlib4'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out reconcile config
33+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
34+
with:
35+
sparse-checkout: .github/zulip-emoji-config.json
36+
sparse-checkout-cone-mode: false
37+
38+
- name: Reconcile
39+
uses: leanprover-community/mathlib-ci/.github/actions/zulip-emoji-reconcile@5668fbbccf0fecefdfcddf539b8406db197dfc59
40+
with:
41+
config: .github/zulip-emoji-config.json
42+
sweep: true
43+
dry-run: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run }}
44+
zulip-api-key: ${{ secrets.ZULIP_API_KEY }}
45+
github-token: ${{ github.token }}

.github/zulip-emoji-config.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"_comment": "Config for the zulip-emoji-reconcile action (see .github/workflows/zulip_emoji_reconcile.yml), which keeps Zulip emoji reactions in sync with PR state. Format and semantics: https://github.com/leanprover-community/mathlib-ci/blob/master/docs/zulip-emoji-reconcile.md. Derived from scripts/zulip/examples/mathlib4-config.json in that repo; keep the two in sync when the emoji table changes.",
3+
4+
"github_repo": "leanprover-community/mathlib4",
5+
6+
"_merged_comment": "bors merges by rebasing a PR's commits onto master, so GitHub reports the PR as CLOSED (not merged) and renames its title to start with '[Merged by Bors] -'. Treat such closed PRs as merged so they get the 'merge' emoji rather than 'closed-pr'. Drop this key for repos that merge via the GitHub merge button/queue, where the PR state is reported as MERGED directly.",
7+
"merged_title_prefix": "[Merged by Bors] -",
8+
9+
"zulip": {
10+
"site": "https://leanprover.zulipchat.com",
11+
"email": "github-mathlib4-bot@leanprover.zulipchat.com"
12+
},
13+
14+
"channels": {
15+
"pr_reviews": "PR reviews",
16+
"reviewers": "mathlib reviewers",
17+
"rss_allow": ["mathlib bors notifications"]
18+
},
19+
20+
"ci": {
21+
"_comment": "Case-insensitive substring match against check-run name, workflow name, or status context. The first three select the gating jobs of 'continuous integration' / 'continuous integration (mathlib forks)' -- their check runs are named 'ci / Build', 'ci (fork) / Build', etc. -- while leaving auxiliary jobs (Upload to cache, Post-CI job) out of the emoji. 'Check workflows' is the actionlint workflow: it runs only on PRs touching .github/**, so it contributes nothing on ordinary PRs and becomes the CI signal on workflows-only PRs where the main CI never triggers.",
22+
"check_names": ["Build", "Lint style", "Post-Build Step", "Check workflows"]
23+
},
24+
25+
"states": [
26+
{
27+
"name": "merged", "group": "pr", "priority": 30,
28+
"source": {"state": "merged"}, "emoji": "merge"
29+
},
30+
{
31+
"name": "closed", "group": "pr", "priority": 20,
32+
"source": {"state": "closed"},
33+
"emoji": "closed-pr", "emoji_code": "61293", "reaction_type": "realm_emoji"
34+
},
35+
{
36+
"name": "ready-to-merge", "group": "pr", "priority": 12,
37+
"source": {"label": "ready-to-merge"},
38+
"emoji": "bors", "emoji_code": "22134", "reaction_type": "realm_emoji"
39+
},
40+
{
41+
"name": "delegated", "group": "pr", "priority": 11,
42+
"source": {"label": "delegated"}, "emoji": "peace_sign"
43+
},
44+
{
45+
"name": "awaiting-author", "group": "pr", "priority": 10,
46+
"source": {"label": "awaiting-author"}, "emoji": "writing"
47+
},
48+
49+
{"name": "ci-running", "group": "ci", "source": {"ci": "running"}, "emoji": "yellow"},
50+
{"name": "ci-success", "group": "ci", "source": {"ci": "success"}, "emoji": "check"},
51+
{"name": "ci-failure", "group": "ci", "source": {"ci": "failure"}, "emoji": "cross_mark"},
52+
53+
{
54+
"name": "maintainer-merge", "group": null,
55+
"source": {"label": "maintainer-merge"}, "emoji": "hammer",
56+
"suppress_in": {"channel": "reviewers", "subject_prefix": "maintainer merge"}
57+
},
58+
{
59+
"name": "migrated", "group": null, "sticky": true,
60+
"source": {"label": "migrated-from-branch"}, "emoji": "skip_forward"
61+
}
62+
]
63+
}

0 commit comments

Comments
 (0)