1616
1717jobs :
1818 build :
19+ name : Build
20+ runs-on : windows-latest
21+ # This condition prevents duplicate runs.
22+ if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
1923 # based on https://github.com/orgs/community/discussions/26253#discussioncomment-6745038
2024 # intent is to run on current ref, unless this is a scheduled run, then run on list defined below
2125 strategy :
2933 - { scheduled: false }
3034 include :
3135 - ref : ${{ github.head_ref || github.ref_name }}
32- runs-on : windows-latest
3336 permissions :
3437 contents : read
3538 packages : write
98101
99102 docker build $docker_args m365/image
100103 echo "digest=$(docker images --no-trunc --quiet $Env:IMAGE.ToLower())" >> $Env:GITHUB_OUTPUT
104+ echo "image=$($Env:IMAGE.ToLower())" >> $Env:GITHUB_OUTPUT
101105 if ($Env:PUSH -eq "true") {
102106 docker push $Env:IMAGE.ToLower() --all-tags
103107 }
@@ -122,3 +126,25 @@ jobs:
122126 cosign sign --yes "$_@$digest"
123127 }
124128 exit 0
129+ outputs :
130+ image : ${{ steps.build-and-push.outputs.image }}
131+ m365-scan :
132+ name : Scan
133+ if : github.ref == 'refs/heads/main'
134+ permissions :
135+ security-events : write
136+ needs : build
137+ runs-on : ubuntu-latest
138+ steps :
139+ - name : Run Trivy vulnerability scanner
140+ uses : aquasecurity/trivy-action@0.28.0
141+ with :
142+ image-ref : ${{ needs.build.outputs.image }}:latest
143+ format : ' sarif'
144+ output : ' trivy-results.sarif'
145+
146+ - name : Upload Trivy scan results to GitHub Security tab
147+ uses : github/codeql-action/upload-sarif@v3
148+ with :
149+ sarif_file : ' trivy-results.sarif'
150+ category : m365-image
0 commit comments