From f89ccaec45154db026a97c0681539cadbdd11c1a Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Wed, 18 Nov 2026 13:02:34 +0000 Subject: [PATCH] Open a tracking issue when a workflow fails on main A failed run on main is only visible in the Actions tab, so breakages that the merge queue does not catch (Windows- or macOS-only test failures, the changelog preview, snapshot builds) can go unnoticed. Add a workflow_run handler that reuses the report-failure action from the dependency bumpers to open one issue per breakage and comment on it for each further failure. Integration tests are not covered: they run in another repository and are not expected to always be green. The action gains optional "workflow" and "run-url" inputs so a workflow_run handler can report on behalf of the failed run; the bumpers keep the current-run defaults. Co-authored-by: Isaac --- .github/actions/report-failure/action.yml | 23 +++++++--- .github/workflows/report-main-failure.yml | 52 +++++++++++++++++++++++ 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/report-main-failure.yml diff --git a/.github/actions/report-failure/action.yml b/.github/actions/report-failure/action.yml index ef63226e162..4f1e4cd1c84 100644 --- a/.github/actions/report-failure/action.yml +++ b/.github/actions/report-failure/action.yml @@ -1,8 +1,9 @@ name: 'Report failure' description: >- - Track failures of a scheduled workflow in a single open issue: open it on the - first failure and comment on it for every subsequent one until someone closes - it. Run this as the last step with "if: failure()". + Track failures of a workflow in a single open issue: open it on the first + failure and comment on it for every subsequent one until someone closes it. + Run this as the last step with "if: failure()", or from a workflow_run + handler with "workflow" and "run-url" pointing at the failed run. Requires the calling job to have "permissions: issues: write". inputs: @@ -12,6 +13,14 @@ inputs: assignees: description: Comma-separated GitHub users to assign to a newly opened issue. required: true + workflow: + description: Name of the failed workflow. Defaults to the current one. + required: false + default: ${{ github.workflow }} + run-url: + description: URL of the failed run. Defaults to the current one. + required: false + default: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} runs: using: 'composite' @@ -23,8 +32,8 @@ runs: GH_REPO: ${{ github.repository }} LABEL: ${{ inputs.label }} ASSIGNEES: ${{ inputs.assignees }} - WORKFLOW: ${{ github.workflow }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + WORKFLOW: ${{ inputs.workflow }} + RUN_URL: ${{ inputs.run-url }} run: |- set -euo pipefail gh label create "$LABEL" --force \ @@ -32,14 +41,14 @@ runs: --description "The $WORKFLOW workflow is failing" issue="$(gh issue list --label "$LABEL" --state open --json number --jq '.[0].number // empty')" if [ -n "$issue" ]; then - gh issue comment "$issue" --body "Failed again: $RUN_URL" + gh issue comment "$issue" --body "\`$WORKFLOW\` failed again: $RUN_URL" else # Assign individuals: a team mention posted by github-actions does not # notify the team's members. gh issue create --label "$LABEL" \ --assignee "$ASSIGNEES" \ --title "$WORKFLOW workflow is failing" \ - --body "@databricks/eng-deco-cli the scheduled \`$WORKFLOW\` workflow failed. + --body "@databricks/eng-deco-cli the \`$WORKFLOW\` workflow failed. $RUN_URL" fi diff --git a/.github/workflows/report-main-failure.yml b/.github/workflows/report-main-failure.yml new file mode 100644 index 00000000000..42ea9527dd4 --- /dev/null +++ b/.github/workflows/report-main-failure.yml @@ -0,0 +1,52 @@ +name: Report main failure + +# Open (or comment on) a tracking issue when one of the workflows below fails +# on main. A failed run on main is otherwise only visible in the Actions tab. +# The merge queue runs most of the same checks before a commit lands, but not +# all of them: the Windows and macOS test cells only run on push, and the +# changelog preview is not a merge-queue check. Integration tests run in +# another repository and are not expected to be green at all times, so they +# are not covered. +on: + workflow_run: + workflows: + - build + - check + - python build + - Changelog Preview + - conftest + - release-build + types: [completed] + branches: [main] + +permissions: + issues: write + +# One push can fail several of these workflows at once. Serialize so the +# first run opens the issue and the others comment on it. +concurrency: + group: report-main-failure + +jobs: + report: + # The "branches" filter matches the head branch of the triggering run, so + # it also admits a pull request from a fork's main branch; the event check + # narrows this to runs of main itself (push and the nightly schedule). + if: >- + github.event.workflow_run.conclusion == 'failure' && + (github.event.workflow_run.event == 'push' || github.event.workflow_run.event == 'schedule') + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + sparse-checkout: .github/actions/report-failure + + - name: Report failure + uses: ./.github/actions/report-failure + with: + label: main-failure + assignees: simonfaltum,andrewnester,anton-107,denik,janniklasrose,pietern,shreyas-goenka + workflow: ${{ github.event.workflow_run.name }} + run-url: ${{ github.event.workflow_run.html_url }}