9898 env :
9999 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
100100
101+ build-and-test :
102+ needs : update-and-create-pr
103+ if : needs.update-and-create-pr.outputs.has_changes == 'true'
104+ uses : ./.github/workflows/main-build.yml
105+ secrets : inherit
106+ with :
107+ caller-workflow-name : nightly-build
108+ ref : nightly-dependency-updates
109+
101110 publish-nightly-build-status :
102111 name : " Publish Nightly Build Status"
103- needs : [update-and-create-pr]
112+ needs : [update-and-create-pr, build-and-test ]
104113 runs-on : ubuntu-latest
105114 if : always()
106115 steps :
@@ -112,9 +121,12 @@ jobs:
112121
113122 - name : Publish nightly build status
114123 run : |
115- # For now, just publish success since we don't have build validation yet
116- value="${{ needs.update-and-create-pr.result == 'success' && '0.0' || '1.0'}}"
117- aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
118- --metric-name Failure \
119- --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
120- --value $value
124+ if [[ "${{ needs.build-and-test.result }}" == "skipped" ]]; then
125+ echo "Build was skipped (no changes), not publishing metric"
126+ else
127+ value="${{ needs.build-and-test.result == 'success' && '0.0' || '1.0'}}"
128+ aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
129+ --metric-name Failure \
130+ --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
131+ --value $value
132+ fi
0 commit comments