Files
notify-email/action.yaml
T

86 lines
3.2 KiB
YAML
Raw Permalink Normal View History

2026-05-13 09:17:11 -07:00
name: Notify by Email
description: |
Send a fritzlab-themed email from a CI workflow via mail.fritzlab.net.
Gating is the caller's responsibility (typically `if: failure()`); the
action always sends when invoked. Auto-injects repo, branch, SHA, workflow,
and run URL — caller supplies subject, summary, and optional details.
inputs:
to:
description: Recipient address.
required: false
default: noc@fritzlab.net
from:
description: Sender address. Must be permitted by mail.fritzlab.net relay rules.
required: false
default: ci@fritzlab.net
status:
description: failure | success | info — drives accent color and subject prefix.
required: false
default: info
subject:
description: Mail subject (status prefix is added automatically). Defaults to summary when empty.
required: false
default: ''
summary:
description: One-line headline rendered at the top of the email body.
required: true
details:
description: Optional multiline preformatted block (rendered in a monospace card). Leave empty to omit.
required: false
default: ''
auto-log:
description: |
If 'true' AND details is empty, fetch the current run's failing-job log via the
Gitea API and render the relevant tail as the details block. Useful for failure
notifications so the email shows the actual error inline. Requires `token`.
required: false
default: 'false'
token:
description: |
Gitea API token used to fetch the run log when `auto-log: true`. Defaults to
the run's per-job GITHUB_TOKEN which has read access to the current repo's
actions. Pass `${{ secrets.CI_BOT_TOKEN }}` only if GITHUB_TOKEN isn't enough.
required: false
default: ${{ github.token }}
log-lines:
description: How many tail lines of the failing step to include when no `::error::` annotation is found.
required: false
default: '40'
2026-05-13 09:17:11 -07:00
smtp-host:
description: SMTP relay host.
required: false
default: mail.fritzlab.net
smtp-port:
description: SMTP port (relay is on 25, trusted-CIDR, no auth).
required: false
default: '25'
runs:
using: composite
steps:
- name: Send notification
shell: bash
env:
NOTIFY_TO: ${{ inputs.to }}
NOTIFY_FROM: ${{ inputs.from }}
NOTIFY_STATUS: ${{ inputs.status }}
NOTIFY_SUBJECT: ${{ inputs.subject }}
NOTIFY_SUMMARY: ${{ inputs.summary }}
NOTIFY_DETAILS: ${{ inputs.details }}
NOTIFY_AUTO_LOG: ${{ inputs.auto-log }}
NOTIFY_TOKEN: ${{ inputs.token }}
NOTIFY_LOG_LINES: ${{ inputs.log-lines }}
2026-05-13 09:17:11 -07:00
NOTIFY_SMTP_HOST: ${{ inputs.smtp-host }}
NOTIFY_SMTP_PORT: ${{ inputs.smtp-port }}
GH_SERVER_URL: ${{ github.server_url }}
GH_REPOSITORY: ${{ github.repository }}
GH_REF_NAME: ${{ github.ref_name }}
GH_SHA: ${{ github.sha }}
GH_WORKFLOW: ${{ github.workflow }}
GH_JOB: ${{ github.job }}
GH_RUN_ID: ${{ github.run_id }}
GH_RUN_NUMBER: ${{ github.run_number }}
GH_RUN_ATTEMPT: ${{ github.run_attempt }}
GH_ACTOR: ${{ github.actor }}
GH_EVENT_NAME: ${{ github.event_name }}
run: python3 ${{ github.action_path }}/scripts/send.py