Repository navigation
fix(guardrail): detect direct pushes using merged PR records - #54
greenc-FNAL wants to merge 2 commits into
Conversation
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the PR-based direct-push guardrail update.
No open issues 🎉
What changed in this PR
Updates the direct-push guardrail to distinguish merges into main from direct branch updates using GitHub’s merged pull request records rather than committer names.
Changes:
- Matches pushed SHAs against merged PRs, supporting rebase merges while still alerting on forced updates.
- Removes the Dependabot exemption and grants only pull request read permission.
- Preserves safe Slack JSON construction and makes API, missing-webhook, and HTTP delivery errors fail the workflow.
| File | Description |
|---|---|
.github/workflows/guardrail-audit-alert.yaml |
Adds PR-based push classification and strengthens Slack alert error handling. |
Review effort: Balanced
Summary
mainusing GitHub's merged-PR records, including rebase merges, rather than trusting committer names or exempting bot pushes.repository.pushed_at, accepting epoch or UTC ISO timestamps within a documented 60-second tolerance. This avoids runner-queue and rerun timing errors and alerts on stale merge restorations.Scope and relationships
Changes are limited to
.github/workflows/guardrail-audit-alert.yaml,.github/workflows/ci.yaml, andtests/test_guardrail_audit_alert.py. Action interfaces, releases, dependencies, and existing Python tooling are unchanged. The guardrail workflow and test file are identical across all fifteen action repositories; other CI content and pins are preserved.This addresses the concern reviewed in action-detect-act-env#53, without using the unsupported
github.run_started_atcontext from Copilot's corrective commit. The guardrail correction can merge independently of the actionlint-pinning PR.Validation
Known limitation
This is best-effort temporal correlation, not complete event-provenance tracking. A rewind and restoration within 60 seconds of the original PR merge may still suppress the restoration alert. That bounded limitation is intentional; exact detection of every replay is outside this change's scope.
mainthrough GitHub’s merged-PR records, including rebase merges. It suppresses an alert only when the PR merge commit, repository, target branch, andrepository.pushed_atmatch within 60 seconds.guardrail-testjob that runs the test module after successful setup. It is not gated on changed files.