@@ -404,6 +404,36 @@ jobs:
404404
405405 echo "Created PR from ${{ needs.update-automation.outputs.staging-branch }} to $TARGET_BRANCH"
406406
407+ publish-new-release-detected :
408+ name : Publish New Release Detected Metric
409+ runs-on : ubuntu-latest
410+ needs : [update-automation]
411+ if : needs.update-automation.outputs.staging-branch != ''
412+ environment : update-automation-workflow-env
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 }}
418+ steps :
419+ - name : Use role credentials for metrics
420+ id : aws-creds
421+ uses : aws-actions/configure-aws-credentials@v4
422+ with :
423+ role-to-assume : ${{ env.AWS_ROLE_TO_ASSUME }}
424+ aws-region : us-east-1
425+ - name : Publish new release detected metric
426+ if : steps.aws-creds.outcome == 'success'
427+ run : |
428+ aws cloudwatch put-metric-data \
429+ --namespace "GitHub/Workflows" \
430+ --metric-name "NewReleaseDetected" \
431+ --dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
432+ --value 1 \
433+ --timestamp $(date -u +%Y-%m-%dT%H:%M:%S.000Z)
434+
435+ echo "Published metric: NewReleaseDetected for version ${{ needs.update-automation.outputs.latest-code-oss-tag }}"
436+
407437 send-notification :
408438 name : Send Notification
409439 runs-on : ubuntu-latest
@@ -434,7 +464,7 @@ jobs:
434464 publish-success-metrics :
435465 name : Publish Success Metrics
436466 runs-on : ubuntu-latest
437- needs : [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification]
467+ needs : [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification, publish-new-release-detected ]
438468 environment : update-automation-workflow-env
439469 if : always() && !failure() && !cancelled()
440470 permissions :
@@ -463,7 +493,7 @@ jobs:
463493 publish-failure-metrics :
464494 name : Publish Failure Metrics
465495 runs-on : ubuntu-latest
466- needs : [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification]
496+ needs : [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification, publish-new-release-detected ]
467497 environment : update-automation-workflow-env
468498 if : failure()
469499 permissions :
0 commit comments