From edf9ff8a54606c466e1b14004a7a0f9395481c38 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Tue, 25 Apr 2023 11:36:51 +0200 Subject: [PATCH] chore: add workflow to dispatch analytics fetching --- .github/workflows/dispatch_analytics.yml | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/dispatch_analytics.yml diff --git a/.github/workflows/dispatch_analytics.yml b/.github/workflows/dispatch_analytics.yml new file mode 100644 index 0000000000..49a276f6f6 --- /dev/null +++ b/.github/workflows/dispatch_analytics.yml @@ -0,0 +1,43 @@ +name: Dispatch analytics + +on: + workflow_dispatch: + + schedule: + - cron: '0 * * * *' + +permissions: + id-token: write + actions: read + checks: read + contents: read + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read + +jobs: + dispatch_token: + concurrency: + group: analytics + runs-on: ubuntu-latest + environment: analytics + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef + with: + aws-region: eu-central-1 + role-to-assume: ${{ secrets.AWS_ANALYTICS_ROLE_ARN }} + + - name: Invoke Lambda function + run: | + payload=$(echo -n '{"githubToken": "${{ secrets.GITHUB_TOKEN }}"}' | base64) + aws lambda invoke \ + --function-name ${{ secrets.AWS_ANALYTICS_DISPATCHER_ARN }} \ + --payload "$payload" response.json + cat response.json