Public Access
48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
name: 'Notify on failure'
|
|
description: 'Create a Gitea issue when a CI workflow fails (calls devx.ci.notify_failure)'
|
|
|
|
# Composite action for the common "Notify on failure" step pattern.
|
|
# Replaces the repeated inline:
|
|
# - name: Notify on failure
|
|
# if: failure()
|
|
# env:
|
|
# CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}
|
|
# run: |
|
|
# . .venv/bin/activate 2>/dev/null || true
|
|
# export PATH="$HOME/.local/bin:$PATH"
|
|
# python3 -m devx.ci.notify_failure \
|
|
# --repo "${{ github.repository }}" \
|
|
# --run-id "${{ github.run_id }}" \
|
|
# --workflow "ci/validate" \
|
|
# --commit "${{ github.sha }}" \
|
|
# --auto-login
|
|
#
|
|
# Gitea 1.27 notes:
|
|
# - `if: failure()` is evaluated in the calling workflow's context and
|
|
# propagates correctly to composite action steps.
|
|
# - `secrets` are not accessible here; the calling workflow's top-level
|
|
# `env:` CI_GITEA_API_TOKEN is used via `${{ env.* }}`.
|
|
|
|
inputs:
|
|
workflow:
|
|
description: 'Workflow/job name used in the Gitea issue title (e.g., ci/validate)'
|
|
required: true
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Notify on failure
|
|
if: failure()
|
|
shell: bash
|
|
env:
|
|
CI_GITEA_API_TOKEN: ${{ env.CI_GITEA_API_TOKEN }}
|
|
run: |
|
|
. .venv/bin/activate 2>/dev/null || true
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
python3 -m devx.ci.notify_failure \
|
|
--repo "${{ github.repository }}" \
|
|
--run-id "${{ github.run_id }}" \
|
|
--workflow "${{ inputs.workflow }}" \
|
|
--commit "${{ github.sha }}" \
|
|
--auto-login
|