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:
1 parent
8b8063bec8
commit
af9b97e111
2 files changed
+10
-9
No files matched your search
@@ -156,20 +156,21 @@ jobs:
|
||||
NTFY_URL: ${{ vars.NTFY_URL }}
|
||||
NTFY_TOKEN: ${{ secrets.NTFY_TOKEN }}
|
||||
SCAN: ${{ steps.scan.outcome }}
|
||||
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }}
|
||||
EVENT: ${{ gitea.event_name }}
|
||||
# The run page is addressed by run ID, not run number. event_name is
|
||||
# always workflow_call here, so the message names the branch instead.
|
||||
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}
|
||||
run: |
|
||||
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)
|
||||
tags=rotating_light
|
||||
else
|
||||
title="Build failed: $GITHUB_REPOSITORY"
|
||||
body="Failed on $GITHUB_REF_NAME"
|
||||
title="Build failed: $GITHUB_REPOSITORY ($GITHUB_REF_NAME)"
|
||||
body=
|
||||
tags=x
|
||||
fi
|
||||
body="${body% }"
|
||||
body="${body:-See run log} ($EVENT)"
|
||||
body="${body:-See run log}"
|
||||
auth=()
|
||||
[ -n "$NTFY_TOKEN" ] && auth=(-H "Authorization: Bearer $NTFY_TOKEN")
|
||||
curl -fsS "${auth[@]}" -H "Title: $title" -H "Tags: $tags" \
|
||||
|
||||
@@ -59,9 +59,9 @@ Optional variable `TRIVY_SERVER` overrides the Trivy server address
|
||||
|
||||
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
|
||||
with their CVE IDs, any other failure with the branch. The notification links
|
||||
to the run. Set secret `NTFY_TOKEN` if the topic needs an access token. Set
|
||||
both on the user or organisation to cover all its repos.
|
||||
with their CVE IDs, any other failure with a pointer to the log. Both name the
|
||||
branch and link to the run. Set secret `NTFY_TOKEN` if the topic needs an
|
||||
access token. Set both on the user or organisation to cover all its repos.
|
||||
|
||||
### Accepting a vulnerability
|
||||
|
||||
|
||||
Reference in new issue
Block a user