name: Dependency advisories
on:
schedule:
- cron: "17 6 * * *"
workflow_dispatch:
push:
paths:
- "deny.toml"
- "Cargo.lock"
- ".github/workflows/audit.yml"
permissions:
contents: read
jobs:
advisories:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - id: deny
continue-on-error: true
uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 with:
command: check advisories bans sources
- name: Open an issue when an advisory is found
if: steps.deny.outcome == 'failure' && github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
title="cargo-deny reported a dependency advisory"
# One open issue at a time: a daily cron would otherwise file a
# duplicate every morning until the advisory is resolved.
existing=$(gh issue list --state open --search "$title in:title" --json number --jq '.[0].number // empty')
if [ -n "$existing" ]; then
echo "Issue #$existing is already open."
exit 0
fi
gh issue create --title "$title" \
--label dependencies \
--body "The scheduled \`cargo deny check\` run failed. See $RUN_URL"
- name: Fail the run
if: steps.deny.outcome == 'failure'
run: exit 1