mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-07 15:09:30 +00:00
feat(process): a red night comments on the tasks merged since the last green one (#736)
A red nightly Validate was a signal "to the author of the latest dev commits" that nobody received: the red run was visible only in Actions, and nobody computed who the author was. - scripts/night-red.mjs: acts only on conclusion=failure of the red run (cancelled, timed_out and the rest are a summary line). The last green night is the newest of the last 50 Validate workflow_dispatch runs on dev that completed successfully, was created before the red run, sits on an ancestor of the red SHA and has a green ci-proof under the release policy, so a light green run (stale) never counts. Suspects are the Issue: trailers of `git rev-list --no-merges G..R` commits that touch a class A/B file and carry no Release: trailer: docs-only and beta-candidate commits do not count, a branch merged by a merge commit brings its second-parent commits, a commit without a trailer is a "no task" summary line, an empty range means a likely flake. One comment per task names both runs, up to ten of its commits and the failed jobs, says "suspect, not guilty" and ends with the marker hp:night-red green=<G> red=<R> commits=<all sha12>. No comment goes to a closed task or to a task whose marker with the same green already lists all its current range commits: one comment per series of red nights until the task commits again; a green night starts a new series. Failures become a ::warning:: and a summary line, exit code 0. - _nightly.yml: dispatch also outputs run_id; a new job night_red runs after it only when dispatch failed with a known run, continue-on-error, permissions actions: read and contents: read (the union with the other jobs is unchanged, thin files in main are untouched), checks out dev with full history without blobs, reads Actions with github.token and writes issues with HP_PROCESS_TOKEN. The header names the addressee. - PROCESS.md §10.4: the "Красная ночь" paragraph next to the nightly ship review. Tests run the scripted rules on real git in temporary repositories with real ci-proof fixtures, and the workflow step on real bash with a local Actions API server and a fake gh. Issue: #736 User-Visible: no Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
This commit is contained in:
@@ -12,7 +12,9 @@
|
||||
#
|
||||
# Красный ночной прогон — сигнал автору последних коммитов на dev, не гейт:
|
||||
# гейт беты по-прежнему требует зелёный Validate на точном SHA кандидата, и
|
||||
# там полный набор идёт заново.
|
||||
# там полный набор идёт заново. Адресат сигнала (#736) — задачи, чьи коммиты
|
||||
# классов A/B вошли в dev после последней зелёной ночи: job `night_red` пишет
|
||||
# каждой один комментарий (`scripts/night-red.mjs`, PROCESS.md §10.4).
|
||||
#
|
||||
# Сигнал обязан быть настоящим (#492 §7): до этой задачи job завершалась
|
||||
# успехом в момент постановки Validate в очередь, и красный полный прогон не
|
||||
@@ -42,6 +44,8 @@ jobs:
|
||||
outputs:
|
||||
# #727: SHA прогона Validate — отдельным шагом до ожидания, красный Validate его не теряет.
|
||||
head_sha: ${{ steps.validate.outputs.head_sha }}
|
||||
# #736: прогон Validate для разбора красной ночи — тем же шагом, до ожидания.
|
||||
run_id: ${{ steps.validate.outputs.run_id }}
|
||||
steps:
|
||||
# #658: при плане 02:30 UTC ночь фактически стартовала в 07:42–08:05 и
|
||||
# кончалась в рабочее время владельца. Сдвиг старта больше часа — видимое
|
||||
@@ -149,3 +153,48 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
echo "- Ship-ревью ночью (\`$CANDIDATE\`): ${{ github.server_url }}/$REPO/actions/runs/$run_id" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
# #736: красная ночь — один комментарий в каждую задачу, чьи коммиты классов
|
||||
# A/B вошли в dev после последней зелёной ночи (`scripts/night-red.mjs`,
|
||||
# PROCESS.md §10.4). Только при красном dispatch с известным прогоном;
|
||||
# исход прогона (failure, а не cancelled/timed_out) скрипт читает сам.
|
||||
# Actions — `github.token`, issue — `HP_PROCESS_TOKEN`: `issues: write` у
|
||||
# ночи нет, и потолок тонкого `nightly.yml` в main не меняется. Сбой —
|
||||
# предупреждение, не красная ночь сверх Validate.
|
||||
night_red:
|
||||
name: "Красная ночь: комментарий в задачи, слитые после последней зелёной"
|
||||
needs: dispatch
|
||||
if: always() && needs.dispatch.result == 'failure' && needs.dispatch.outputs.run_id != ''
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
steps:
|
||||
# Нужны коммиты и деревья, не блобы; скрипт и его импорты — без зависимостей, npm ci не нужен.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
ref: dev
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: "Комментарий в задачи диапазона от последней зелёной ночи до красной"
|
||||
env:
|
||||
ACTIONS_TOKEN: ${{ github.token }}
|
||||
GH_TOKEN: ${{ secrets.HP_PROCESS_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
RED_RUN: ${{ needs.dispatch.outputs.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Сбои API, токена и git скрипт сам сводит к предупреждению; упавший
|
||||
# скрипт — тоже предупреждение: цвет ночи — цвет Validate.
|
||||
if ! node scripts/night-red.mjs --repo="$REPO" --red-run="$RED_RUN"; then
|
||||
echo "::warning::красная ночь (#736): скрипт упал — комментарии не написаны; цвет ночи — цвет Validate"
|
||||
echo "- Красная ночь (#736): скрипт упал — комментарии не написаны" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user