Only login to Docker Hub when pushing on master branch

This commit is contained in:
Tim de Pater
2021-12-29 08:29:18 +01:00
parent 3594f511f3
commit 302cf16dcc

View File

@@ -38,7 +38,7 @@ jobs:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ env.IMAGE_NAME }}:${{ github.sha }}'
image-ref: '${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
@@ -49,6 +49,7 @@ jobs:
sarif_file: 'trivy-results.sarif'
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}