Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions .github/workflows/update-automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,37 @@ jobs:
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
--value 1

handle-failures:
name: Handle Failures
publish-success-metrics:
name: Publish Success Metrics
runs-on: ubuntu-latest
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification]
environment: update-automation-workflow-env
if: always() && !failure() && !cancelled()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch adding the !cancelled(). It looks like this will work, but the always() seems redundant, because afaik it always resolves to true (ie: <true> && <true|false> && <true|false> )

permissions:
id-token: write # Required for OIDC
env:
REPOSITORY: ${{ github.repository }}
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
steps:
- name: Use role credentials for metrics
id: aws-creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
aws-region: us-east-1
- name: Publish success metrics
if: steps.aws-creds.outcome == 'success'
run: |
aws cloudwatch put-metric-data \
--namespace "GitHub/Workflows" \
--metric-name "ExecutionsSucceeded" \
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
--value 1

echo "Published metric: ExecutionsSucceeded"

publish-failure-metrics:
name: Publish Failure Metrics
runs-on: ubuntu-latest
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification]
environment: update-automation-workflow-env
Expand All @@ -450,11 +479,13 @@ jobs:
with:
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
aws-region: us-east-1
- name: Report failure
- name: Publish failure metrics
if: steps.aws-creds.outcome == 'success'
run: |
aws cloudwatch put-metric-data \
--namespace "GitHub/Workflows" \
--metric-name "ExecutionsFailed" \
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
--value 1
--value 1

echo "Published metric: ExecutionsFailed"
Loading