Replies: 3 comments 2 replies
|
Thank you for your interest in contributing to our community! We currently only accept discussions created through the GitHub UI using our provided discussion templates. Please re-submit your discussion by navigating to the appropriate category and using the template provided. This discussion has been closed because it was not submitted through the expected format. If you believe this was a mistake, please reach out to the maintainers. |
|
This is one of the most-requested Actions gaps, and the reason none of the adjacent features solve it is worth stating in your request so it doesn't get closed as a duplicate:
For the feature request itself, the crisp framing is: a |
|
The native "one signal when everything for a SHA is done" doesn't exist yet — but you can build it today with Design: a dedicated "hub" workflow triggered via name: pipeline-hub
on:
workflow_run:
workflows: [CI, Test, Deploy] # names of the workflows to track
types: [completed]
jobs:
aggregate:
runs-on: ubuntu-latest
permissions:
checks: write
actions: read
steps:
- name: Aggregate run statuses for head SHA
env:
GH_TOKEN: ${{ github.token }}
run: |
SHA="${{ github.event.workflow_run.head_sha }}"
RUNS=$(gh api "/repos/${{ github.repository }}/actions/runs?head_sha=$SHA&per_page=100" -q '.workflow_runs[] | select(.display_title != "pipeline-hub") | .status')
PENDING=$(printf '%s
' "$RUNS" | grep -Ev 'completed|cancelled|skipped|failure|success' | wc -l)
FAILS=$(printf '%s
' "$RUNS" | grep -c 'failure')
CONC="success"; [ "$PENDING" -gt 0 ] && CONC="in_progress"; [ "$FAILS" -gt 0 ] && CONC="failure"
gh api -X POST "/repos/${{ github.repository }}/check-runs" -f name="pipeline-complete" -f head_sha="$SHA" -f status=completed -f conclusion="$CONC" -f 'output[title]=Pipeline execution finished'Caveats I hit when deploying this:
Worth voting this idea up — a native |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Why are you starting this discussion?
Product Feedback
What GitHub Actions topic or product is this about?
Workflow Configuration
Discussion Details
The ask
One signal — a trigger or a webhook — that fires when all workflow runs for a given commit / PR head SHA have reached a terminal state.
Completion, not success. I need to know the pipeline is done, whatever the outcome.
Why this isn't the existing requests
There are several older threads asking for something adjacent, and I want to be explicit that this is not a duplicate of them:
check_run/check_suite/statuseventsThose are all asking for a gating primitive: "tell me when everything went green." This request is for a completion / aggregation primitive: "tell me when everything has finished, pass or fail." The use case is analysing a finished pipeline — you specifically need the failures, so success-gated triggers cannot serve it.
Why today's events don't cover it
Every event GitHub exposes here is per-item.
workflow_run,check_run,workflow_jobandstatuseach fire once per individual item. There is no aggregate.check_suitelooks like the exception, because the documentation describes it as "All check runs in a check suite have completed, and a conclusion is available." That reads exactly like the aggregate signal — but a check suite is scoped per app per workflow run, not per commit.Concretely, on one of our pull requests, a single head SHA had 20 check suites, 6+ of them from
github-actionsalone:So
check_suite.completedhas the same granularity asworkflow_run.completed. I would gently suggest the docs wording forcheck_suiteis misleading on its own merits and worth correcting regardless of this request — it strongly implies a per-commit aggregate that does not exist.A related trap for anyone attempting this: of those 20 suites, 13 were permanently
queuedwithruns=0— apps subscribed to the repository that never create check runs at all. So you cannot converge on check suites either; you have to converge on check runs, which only exist once an app actually reports.The only available workaround, and what it costs
The fan-in pattern: trigger on
workflow_run: [completed], and on every single fire query the Checks API to ask "is everything else done yet?" — exiting immediately if not.That means one full workflow run spawned per completed workflow, purely to discover there is nothing to do.
The arithmetic is per push. A pull request with 10–15 workflows spawns 10–15 extra runs, of which all but one are no-ops. At a moderately busy organisation seeing 100–200 pushes a day, that is on the order of 1,500–3,000 workflow runs per day whose only purpose is to start up and exit immediately. This is the recommended workaround, so the same multiplier applies to everyone who adopts it.
That is a large amount of runner scheduling, queueing and Actions minutes, and the cost is borne by GitHub's own infrastructure at least as much as by the user.
It also carries correctness traps that make it fragile rather than merely wasteful:
workflow_runrequires an explicitworkflows:list, and there is no glob support for it. The docs enumerate the keys that accept glob patterns —branches,branches-ignore,tags,tags-ignore,paths,paths-ignore— andworkflowsis absent from that list.workflows-ignoreto invert the problem, even though the very same event already hasbranches-ignore.check_run/check_suitecannot substitute, because they do not trigger workflows when the check suite was created by GitHub Actions (documented recursion prevention) — which is precisely the case for every Actions workflow.Proposal
Ideal: an aggregate event — e.g.
checks_completed/workflow_runs_completed— on a commit or pull request, firing once when all workflow runs have reached a terminal state, ideally with a configurable quiescence window so late-starting workflows don't cause a premature fire.Failing that, two much smaller changes would remove most of the pain, and both match precedent that already exists on this very event:
workflows:—branches,tagsandpathsalready accept globs;workflowsis the odd one out.workflows-ignore:key — pure symmetry with thebranches-ignorealready available onworkflow_run.Either of those makes the fan-in workaround maintainable at scale. The aggregate event makes it unnecessary.
Happy to provide more detail on the measurements above if useful.
All reactions