Skip to content

Commit

Permalink
Run Docker Scout compare on PRs (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-h05 authored Mar 13, 2024
1 parent 3f377de commit ab42edc
Showing 1 changed file with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
tags: [ 'v*.*.*' ] # Publishes with latest tag.
Expand All @@ -13,11 +8,11 @@ on:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
COMPARE_TAG: main

jobs:
build:
Expand All @@ -26,6 +21,7 @@ jobs:
permissions:
contents: read
packages: write
pull-requests: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
Expand Down Expand Up @@ -97,3 +93,20 @@ jobs:
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

# Use Docker Scout to analyze security vulnerabilities
# https://github.com/docker/scout-action
- name: Docker Scout
id: docker-scout
if: ${{ github.event_name == 'pull_request' }}
uses: docker/scout-action@v1
with:
dockerhub-user: ${{ secrets.DOCKER_USER }}
dockerhub-password: ${{ secrets.DOCKER_PAT }}
command: compare
image: ${{ steps.meta.outputs.tags }}
to: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.COMPARE_TAG }}
ignore-unchanged: true
only-severities: critical,high
write-comment: true
github-token: ${{ secrets.GITHUB_TOKEN }} # to be able to write the comment

0 comments on commit ab42edc

Please sign in to comment.