mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
A title or body edit fires ci, regression and windows-render again on the same head commit. When the previous run of that workflow on the commit passed, Detect changes now reports no changes, so the check jobs skip and their required checks still pass. Base changes, first runs and runs whose predecessor failed, was cancelled or is unfinished still run everything. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
37 lines
1.7 KiB
YAML
37 lines
1.7 KiB
YAML
name: Edit already passed
|
|
description: |
|
|
Reports whether this run comes from a pull request title or body edit on a
|
|
head commit whose previous run of the same workflow passed. Such an edit
|
|
cannot change the result, so callers skip their checks and the skipped
|
|
required checks still pass. A base change, a first run, or a previous run
|
|
that failed, was cancelled or is unfinished returns false and runs them again.
|
|
The calling job needs `actions: read`.
|
|
|
|
outputs:
|
|
passed:
|
|
description: "`true` when the previous run on this head commit passed."
|
|
value: ${{ steps.previous.outputs.passed }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- id: previous
|
|
if: github.event.action == 'edited' && github.event.changes.base == null
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
|
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
|
run: |
|
|
workflow="$(basename "${GITHUB_WORKFLOW_REF%%@*}")"
|
|
conclusion="$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/$workflow/runs?event=pull_request&head_sha=$HEAD_SHA&per_page=100" --jq '
|
|
[.workflow_runs[]
|
|
| select(.id < (env.GITHUB_RUN_ID | tonumber)
|
|
and .head_branch == env.HEAD_REF
|
|
and .head_repository.full_name == env.HEAD_REPO)]
|
|
| max_by(.id) | .conclusion // "none"')" || conclusion="lookup failed"
|
|
echo "Previous $workflow run on $HEAD_SHA: $conclusion"
|
|
if [ "$conclusion" = success ]; then passed=true; else passed=false; fi
|
|
echo "passed=$passed" >> "$GITHUB_OUTPUT"
|