From fcaca79e93d42c1b7c70f2b39ddf3586d1ef8e44 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Tue, 2 Jan 2024 14:48:03 +0100 Subject: [PATCH] fix(ci): fail dispatch analytics job when Lambda call fails (#3579) --- .github/workflows/dispatch_analytics.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dispatch_analytics.yml b/.github/workflows/dispatch_analytics.yml index b94c7439f7b..3f4d75a0249 100644 --- a/.github/workflows/dispatch_analytics.yml +++ b/.github/workflows/dispatch_analytics.yml @@ -51,7 +51,16 @@ jobs: - 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 + response=$(aws lambda invoke \ + --function-name "${{ secrets.AWS_ANALYTICS_DISPATCHER_ARN }}" \ + --payload "$payload" \ + response.json \ + --query 'FunctionError' \ + --output text) + + cat response.json ; echo # add newline at the end + + if [ "$response" != "None" ]; then + echo "Error invoking lambda function: $response. Aborting." + exit 1 + fi