Release Vulnerability Check #131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@af78098f536edbc4de71162a307590698245be95 # v3.0.1 | |
| 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 }}>" | |
| } |