Skip to content

Release Vulnerability Check #136

Release Vulnerability Check

Release Vulnerability Check #136

name: Release Vulnerability Check
on:
workflow_dispatch: {}
schedule:
- cron: '0 8 * * 0-4' # Sun-Thu, at 8:00 UTC
permissions:
contents: read
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
jobs:
fetch-release-info:
name: Fetch release information
runs-on: ubuntu-24.04
outputs:
release_tag: ${{ steps.release.outputs.release_tag }}
steps:
- name: Fetch latest release tag
id: release
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/open-policy-agent/opa/releases/latest | jq -r .tag_name)
echo "release_tag=${LATEST_RELEASE}" >> $GITHUB_OUTPUT
echo "### 🔍 Release Vulnerability Checks" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Checking vulnerabilities for:" >> $GITHUB_STEP_SUMMARY
echo "- **Release**: [${LATEST_RELEASE}](https://github.com/open-policy-agent/opa/releases/tag/${LATEST_RELEASE})" >> $GITHUB_STEP_SUMMARY
govulncheck-latest-release:
name: Go vulnerability check (latest release)
runs-on: ubuntu-24.04
needs: fetch-release-info
steps:
- name: Check out latest release
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ needs.fetch-release-info.outputs.release_tag }}
persist-credentials: false
- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT
- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ steps.go_version.outputs.go_version }}
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...
- name: Slack Notification
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # v3.0.2
if: failure() && env.SLACK_WEBHOOK_URL != ''
with:
webhook: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }} # zizmor: ignore[secrets-outside-env]
webhook-type: incoming-webhook
payload: |
{
"text": "Vulnerabilities found in ${{ needs.fetch-release-info.outputs.release_tag }}: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} - ${{ github.job }}>"
}