Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stats-lambda.yml #6583

Merged
merged 1 commit into from
Jun 26, 2024
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
22 changes: 18 additions & 4 deletions .github/workflows/stats-lambda.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# This workflow executes a Lamdba function that records metrics for each successfully merged PR.
# This workflow executes a Lamdba function that records metrics for each merged PR.
#
# For more information, see:
# https://github.com/marketplace/actions/invoke-aws-lambda

name: Trigger Lambda to capture metrics

permissions:
contents: read
id-token: write

on: # yamllint disable-line rule:truthy
pull_request:
types:
Expand All @@ -12,20 +17,29 @@ on: # yamllint disable-line rule:truthy
env:
COMMIT: ${{github.event.pull_request.head.sha}}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
AWS_REGION: "eu-west-1"
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
name: GitHub Statistics
steps:
- name: Configure AWS Credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{env.AWS_REGION}}
role-to-assume: arn:aws:iam::959731285276:role/run-the-numbers-lambda
output-credentials: true
- name: Create payload
run: echo "JSON_PAYLOAD={\"commit\" :\"${{ env.COMMIT }}\",\"author\" :\"${{ env.PR_AUTHOR }}\"}" >> $GITHUB_ENV
- name: Invoke Lambda
uses: gagoar/invoke-aws-lambda@master
with:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
REGION: 'eu-west-1'
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
REGION: ${{env.AWS_REGION}}
FunctionName: runTheNumbers
Payload: ${{env.JSON_PAYLOAD}}
InvocationType: RequestResponse
Expand Down
Loading