diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index 313c161..bf3c9b8 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -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" \ diff --git a/README.md b/README.md index 4d44746..8bb516e 100644 --- a/README.md +++ b/README.md @@ -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