ntfy: link run by ID, name the branch

The run page is addressed by run ID, not run number, and event_name is
always workflow_call in a called workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thomas.gloorandClaude Opus 5.5 committed 2026-10-26 09:33:27 +01:00
1 parent 8b8063bec8
commit af9b97e111
2 files changed
+10 -9

No files matched your search

+7 -6
View File
@@ -156,20 +156,21 @@ jobs:
NTFY_URL: ${{ vars.NTFY_URL }} NTFY_URL: ${{ vars.NTFY_URL }}
NTFY_TOKEN: ${{ secrets.NTFY_TOKEN }} NTFY_TOKEN: ${{ secrets.NTFY_TOKEN }}
SCAN: ${{ steps.scan.outcome }} SCAN: ${{ steps.scan.outcome }}
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }} # The run page is addressed by run ID, not run number. event_name is
EVENT: ${{ gitea.event_name }} # always workflow_call here, so the message names the branch instead.
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}
run: | run: |
if [ "$SCAN" = failure ] && [ -f trivy.log ]; then if [ "$SCAN" = failure ] && [ -f trivy.log ]; then
title="CVEs in $GITHUB_REPOSITORY" title="CVEs in $GITHUB_REPOSITORY ($GITHUB_REF_NAME)"
body=$(grep -oE '(CVE|GHSA)-[0-9A-Za-z-]+' trivy.log | sort -u | tr '\n' ' ' || true) body=$(grep -oE '(CVE|GHSA)-[0-9A-Za-z-]+' trivy.log | sort -u | tr '\n' ' ' || true)
tags=rotating_light tags=rotating_light
else else
title="Build failed: $GITHUB_REPOSITORY" title="Build failed: $GITHUB_REPOSITORY ($GITHUB_REF_NAME)"
body="Failed on $GITHUB_REF_NAME" body=
tags=x tags=x
fi fi
body="${body% }" body="${body% }"
body="${body:-See run log} ($EVENT)" body="${body:-See run log}"
auth=() auth=()
[ -n "$NTFY_TOKEN" ] && auth=(-H "Authorization: Bearer $NTFY_TOKEN") [ -n "$NTFY_TOKEN" ] && auth=(-H "Authorization: Bearer $NTFY_TOKEN")
curl -fsS "${auth[@]}" -H "Title: $title" -H "Tags: $tags" \ curl -fsS "${auth[@]}" -H "Title: $title" -H "Tags: $tags" \
+3 -3
View File
@@ -59,9 +59,9 @@ Optional variable `TRIVY_SERVER` overrides the Trivy server address
If variable `NTFY_URL` is set (full topic URL, e.g. If variable `NTFY_URL` is set (full topic URL, e.g.
`https://ntfy.hin-fort.ch/ci`), a failed build posts to ntfy: Trivy findings `https://ntfy.hin-fort.ch/ci`), a failed build posts to ntfy: Trivy findings
with their CVE IDs, any other failure with the branch. The notification links with their CVE IDs, any other failure with a pointer to the log. Both name the
to the run. Set secret `NTFY_TOKEN` if the topic needs an access token. Set branch and link to the run. Set secret `NTFY_TOKEN` if the topic needs an
both on the user or organisation to cover all its repos. access token. Set both on the user or organisation to cover all its repos.
### Accepting a vulnerability ### Accepting a vulnerability