Skip to content

Commit ea5abe2

Browse files
authored
Added step for notification for pr creation (#49)
1 parent 9714a53 commit ea5abe2

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

.github/workflows/update-automation.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,37 @@ jobs:
404404
405405
echo "Created PR from ${{ needs.update-automation.outputs.staging-branch }} to $TARGET_BRANCH"
406406
407+
send-notification:
408+
name: Send Notification
409+
runs-on: ubuntu-latest
410+
needs: [update-automation, create-pr]
411+
environment: update-automation-workflow-env
412+
permissions:
413+
id-token: write # Required for OIDC
414+
env:
415+
REPOSITORY: ${{ github.repository }}
416+
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
417+
steps:
418+
- name: Use role credentials for notification
419+
id: aws-creds
420+
continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }}
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: Send notification
426+
if: steps.aws-creds.outcome == 'success'
427+
run: |
428+
aws cloudwatch put-metric-data \
429+
--namespace "GitHub/Workflows" \
430+
--metric-name "PRCreated" \
431+
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=UpdateAutomation" \
432+
--value 1
433+
407434
handle-failures:
408435
name: Handle Failures
409436
runs-on: ubuntu-latest
410-
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr]
437+
needs: [update-automation, build-and-update-package-locks, generate-oss-attribution, create-pr, send-notification]
411438
environment: update-automation-workflow-env
412439
if: failure()
413440
permissions:

0 commit comments

Comments
 (0)