Skip to content

Commit 74c6fb4

Browse files
committed
publish metric for nightly build failures
1 parent 1357fc8 commit 74c6fb4

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/nightly-build.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- zhaez/nightly-build
1010

1111
env:
12+
AWS_DEFAULT_REGION: us-east-1
1213
BRANCH_NAME: nightly-dependency-updates
1314

1415
jobs:
@@ -117,4 +118,28 @@ jobs:
117118
id-token: write
118119
contents: read
119120
with:
120-
ref: nightly-dependency-updates
121+
ref: nightly-dependency-updates
122+
123+
publish-nightly-build-status:
124+
name: "Publish Nightly Build Status"
125+
needs: [ update-and-create-pr, build-and-test ]
126+
runs-on: ubuntu-latest
127+
if: always()
128+
steps:
129+
- name: Configure AWS Credentials for emitting metrics
130+
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #5.0.0
131+
with:
132+
role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }}
133+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
134+
135+
- name: Publish nightly build status
136+
run: |
137+
if [[ "${{ needs.build-and-test.result }}" == "skipped" ]]; then
138+
echo "Build was skipped (no changes), not publishing metric"
139+
else
140+
value="${{ needs.build-and-test.result == 'success' && '0.0' || '1.0'}}"
141+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
142+
--metric-name Failure \
143+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
144+
--value $value
145+
fi

0 commit comments

Comments
 (0)