59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
# PR check (Renovate bumps of Trivy / gitleaks, and any other PR): the
|
|
# actions of THIS branch must actually run. Both runtimes of trivy-gate:
|
|
# the Trivy container (docker job) and the pinned binary with its checksum
|
|
# check (container job without Docker) - a bump with a wrong checksum fails
|
|
# here, not in every pipeline that uses the next tag. Required by branch
|
|
# protection, so a green PR automerges and tag.yml cuts the next vN.
|
|
name: pr-check
|
|
on:
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: pr-check-${{ github.head_ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- name: trivy-gate, Trivy container, image scan
|
|
id: image
|
|
uses: ./trivy-gate
|
|
with:
|
|
image: alpine:3.22@sha256:2e0b81d60597f449baa56dc25d355367869d2dca4cd57e866f1e2b52af3eb55f
|
|
runtime: docker
|
|
mode: warn
|
|
- name: The report is real
|
|
run: |
|
|
set -euo pipefail
|
|
jq -e '.Results | length > 0' "${{ steps.image.outputs.report }}" >/dev/null
|
|
echo "blocking=${{ steps.image.outputs.blocking }}"
|
|
- name: gitleaks
|
|
uses: ./gitleaks
|
|
with:
|
|
mode: block
|
|
|
|
binary:
|
|
runs-on: ubuntu-latest
|
|
# No Docker CLI here, so trivy-gate falls back to the pinned binary.
|
|
container:
|
|
image: node:26-trixie-slim@sha256:94816674c62774da0d099a947bf4613b9e1972a2733abd0d0cd80e795f8411d0
|
|
steps:
|
|
- name: Tools the actions expect
|
|
run: apt-get update -qq && apt-get install -y -qq --no-install-recommends ca-certificates curl git jq >/dev/null
|
|
- uses: actions/checkout@v7
|
|
- name: trivy-gate, pinned binary, fs scan
|
|
id: fs
|
|
uses: ./trivy-gate
|
|
with:
|
|
scan-type: fs
|
|
runtime: binary
|
|
mode: warn
|
|
- name: The report is real
|
|
run: jq -e 'has("Results") or has("ArtifactName")' "${{ steps.fs.outputs.report }}" >/dev/null
|
|
- name: gitleaks, pinned binary
|
|
uses: ./gitleaks
|
|
with:
|
|
mode: block
|