Skip to content

Commit 302cf16

Browse files
committed
Only login to Docker Hub when pushing on master branch
1 parent 3594f51 commit 302cf16

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/build.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Run Trivy vulnerability scanner
3939
uses: aquasecurity/trivy-action@master
4040
with:
41-
image-ref: '${{ env.IMAGE_NAME }}:${{ github.sha }}'
41+
image-ref: '${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}'
4242
format: 'template'
4343
template: '@/contrib/sarif.tpl'
4444
output: 'trivy-results.sarif'
@@ -49,6 +49,7 @@ jobs:
4949
sarif_file: 'trivy-results.sarif'
5050

5151
- name: Login to Docker Hub
52+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
5253
uses: docker/login-action@v1
5354
with:
5455
username: ${{ secrets.DOCKERHUB_USERNAME }}

0 commit comments

Comments
 (0)