Update Automation #108
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Automation | |
| on: | |
| # schedule: | |
| # - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| send-notification: | |
| name: Send Notification | |
| runs-on: ubuntu-latest | |
| environment: update-automation-workflow-env | |
| 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 notification | |
| id: aws-creds | |
| continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }} | |
| aws-region: us-east-1 | |
| - name: Send notification | |
| if: steps.aws-creds.outcome == 'success' | |
| run: | | |
| aws cloudwatch put-metric-data \ | |
| --namespace "GitHub/Workflows" \ | |
| --metric-name "PRCreated" \ | |
| --dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \ | |
| --value 1 | |
| handle-failures: | |
| name: Handle Failures | |
| runs-on: ubuntu-latest | |
| needs: [send-notification] | |
| environment: update-automation-workflow-env | |
| if: failure() | |
| 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 | |
| continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }} | |
| aws-region: us-east-1 | |
| - name: Report failure | |
| 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 |