Skip to content

Commit 5732473

Browse files
authored
Added publish metrics to the update-automation workflow (#48)
1 parent b39745b commit 5732473

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/update-automation.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,26 @@ jobs:
408408
name: Handle Failures
409409
runs-on: ubuntu-latest
410410
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr]
411+
environment: update-automation-workflow-env
411412
if: failure()
413+
permissions:
414+
id-token: write # Required for OIDC
415+
env:
416+
REPOSITORY: ${{ github.repository }}
417+
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
412418
steps:
413-
- name: Report rebase failures
419+
- name: Use role credentials for metrics
420+
id: aws-creds
421+
continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }}
422+
uses: aws-actions/configure-aws-credentials@v4
423+
with:
424+
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
425+
aws-region: us-east-1
426+
- name: Report failure
427+
if: steps.aws-creds.outcome == 'success'
414428
run: |
415-
# TODO: Implement metric reporting to CW.
416-
exit 1
429+
aws cloudwatch put-metric-data \
430+
--namespace "GitHub/Workflows" \
431+
--metric-name "ExecutionsFailed" \
432+
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
433+
--value 1

0 commit comments

Comments
 (0)