|
|
|
|
Quelle zulip_emoji_reconcile.yml Sprache: unbekannt
|
|
Spracherkennung für: .yml vermutete Sprache: Abap {ABAP[52] Apollo[36] Fortran[36]} [Methode: maximale Elemente, drei Dimensionen]
# Keeps the Zulip emoji reactions on PR-related messages in sync with each PR 's
# actual state (open/closed/merged, labels, CI result). One job, fed by three
# kinds of trigger:
# - schedule: hourly sweep — the self-healing safety net that repairs
# any drift the event triggers miss (dropped webhooks,
# outages, state changes while a run was broken).
# - pull_request_target: label/close/merge/reopen changes, reflected in seconds.
# - workflow_run: CI start/finish, so the CI emoji updates promptly.
# Everything repo-specific lives in `.github/zulip-emoji-config.json`; the
# engine and its docs are in mathlib-ci:
# https://github.com/leanprover-community/mathlib-ci/blob/master/docs/zulip-emoji-reconcile.md
name: Zulip emoji reconcile
on:
schedule:
- cron: "37 * * * *" # hourly, offset to dodge top-of-hour runner load
workflow_dispatch:
inputs:
pr:
description: PR number(s), space-separated; leave empty to sweep recent messages
required: false
default: ""
dry-run:
description: Log planned reaction changes without modifying Zulip
type: boolean
default: false
pull_request_target: # label/close/merge/reopen changes, within seconds
types: [labeled, unlabeled, closed, reopened]
workflow_run: # CI start/finish, so the CI emoji updates promptly
workflows: ["continuous integration", "continuous integration (mathlib forks)"]
types: [requested, completed]
concurrency:
# Serialize runs: the reconciler reads live PR state and then writes reactions,
# so two interleaved runs could re-assert stale state. GitHub keeps only the
# newest queued run per group (earlier pending runs are canceled), which suits a
# level-triggered tool — the last run recomputes everything from live state and
# converges to the final answer. One *shared* group is deliberate: the same PR
# reaches this workflow under different keys (pull_request.number,
# workflow_run.head_sha, nothing on a sweep), so per-PR groups would leave
# exactly those cross-trigger races open.
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: read
pull-requests: read
jobs:
reconcile:
if: github.repository == 'leanprover-community/mathlib4 '
runs-on: ubuntu-latest
steps:
# On pull_request_target / workflow_run this checks out the *default*
# branch, so the config (and everything else in this job) is never
# PR-controlled.
- name: Check out reconcile config
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: |
.github/zulip-emoji-config.json
sparse-checkout-cone-mode: false
- name: Determine PR number(s)
id: target
env:
GH_TOKEN: ${{ github.token }}
EVENT: ${{ github.event_name }}
INPUT_PR: ${{ inputs.pr }}
EVENT_PR: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
run: |
set -euo pipefail
case "$EVENT" in
workflow_dispatch) pr="$INPUT_PR" ;;
pull_request_target) pr="$EVENT_PR" ;;
workflow_run)
# HEAD_REPO is empty if the fork was deleted;
# leave pr empty then (the hourly sweep covers it).
pr=""
if [ -n "$HEAD_REPO" ]; then
# Keep only PRs into this repo, not ones within the fork.
pr=$(gh api "repos/${HEAD_REPO}/commits/${HEAD_SHA}/pulls" \
--jq 'map( select(.base.repo.full_name == env.GITHUB_REPOSITORY) | .number) | join( " ") ')
fi
;;
*) pr="" ;; # schedule -> sweep
esac
echo "pr=${pr}" >> "$GITHUB_OUTPUT"
- name: Reconcile
# Emoji reactions are cosmetic: a Zulip or API hiccup must never put a
# red X (or send a failure email) on a contributor's PR or a CI run. So
# the two contributor-facing event triggers swallow failures, matching
# the ` continue- on-error` the retired event-driven workflows carried.
# The hourly `schedule` sweep and manual `workflow_dispatch` runs stay
# loud: the sweep is the health signal for the reconciler itself, and a
# manual run is someone actively debugging who wants to see the error.
continue- on-error: ${{ github.event_name == 'pull_request_target' || github.event_name == 'workflow_run' }}
# Skip a workflow_run whose head commit no longer maps to a PR; schedule
# and PR-less dispatches sweep instead.
if: steps.target.outputs.pr != '' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
uses: leanprover-community/mathlib-ci/.github/actions/zulip-emoji-reconcile@d6393a535c054122e507b6c5e1b2f4c31c604121
with:
config: .github/zulip-emoji-config.json
pr: ${{ steps.target.outputs.pr }}
sweep: ${{ !steps.target.outputs.pr }}
dry-run: ${{ inputs.dry-run == true }}
zulip-api-key: ${{ secrets.ZULIP_API_KEY }}
github-token: ${{ github.token }}
[Dauer der Verarbeitung: 0.3 Sekunden, vorverarbeitet 2026-11-18]
|
2026-11-24
|
|
|
|
|