From 0543f8f366bb6b5662dd9c82cc9ccef7b14ef947 Mon Sep 17 00:00:00 2001 From: 0618 Date: Tue, 20 Sep 2022 12:03:46 -0700 Subject: [PATCH 1/5] feat: log metrics to github-workflows account Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com> --- .github/actions/log-metric/action.yml | 5 ++- .github/workflows/publish-latest.yml | 44 +++++++++++++++++++-- .github/workflows/publish-next.yml | 47 +++++++++++++++++++++-- .github/workflows/run-and-test-builds.yml | 44 +++++++++++++++++++-- 4 files changed, 127 insertions(+), 13 deletions(-) diff --git a/.github/actions/log-metric/action.yml b/.github/actions/log-metric/action.yml index dd0cdfabd19..84e73c843c9 100644 --- a/.github/actions/log-metric/action.yml +++ b/.github/actions/log-metric/action.yml @@ -13,6 +13,9 @@ inputs: AWS_SECRET_ACCESS_KEY: description: 'target AWS account credentials' required: true + AWS_REGION: + description: 'target AWS account region' + required: true runs: using: 'composite' steps: @@ -21,6 +24,6 @@ runs: with: aws-access-key-id: ${{ inputs.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ inputs.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 + aws-region: ${{ inputs.AWS_REGION }} - shell: bash run: aws cloudwatch put-metric-data --metric-name ${{ inputs.metric-name }} --namespace GithubCanaryApps --value ${{ inputs.value }} diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml index 80ec24b4fa4..ac437b182a1 100644 --- a/.github/workflows/publish-latest.yml +++ b/.github/workflows/publish-latest.yml @@ -105,8 +105,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - log-failure-metric: - # Send data point 1 to metric PublishLatestFailure, if it's a failure + log-failure-metric-prod: + # to be deprecated once log-failure-metric is up + # Send data point 1 to metric PublishLatestFailure in prod us-east-1, if it's a failure runs-on: ubuntu-latest environment: ci needs: publish @@ -119,9 +120,11 @@ jobs: value: 1 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 - log-success-metric: - # Send data point 0 to metric PublishLatestFailure, if it's a success + log-success-metric-prod: + # to be deprecated once log-success-metric is up + # Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: publish @@ -134,3 +137,36 @@ jobs: value: 0 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + + log-failure-metric: + # Send data point 1 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a failure + runs-on: ubuntu-latest + environment: ci + needs: publish + if: ${{ failure() }} + steps: + - name: Log failure data point to metric PublishLatestFailure + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishLatestFailure + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 + + log-success-metric: + # Send data point 0 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a success + runs-on: ubuntu-latest + environment: ci + needs: publish + if: ${{ success() }} + steps: + - name: Log success data point to metric PublishLatestFailure + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishLatestFailure + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml index acb25d94ee6..fcc039c5df6 100644 --- a/.github/workflows/publish-next.yml +++ b/.github/workflows/publish-next.yml @@ -145,8 +145,9 @@ jobs: run: yarn build working-directory: ./canary - log-failure-metric: - # Send data point 1 to metric PublishNextFailure, if it's a failure + log-failure-metric-prod: + # to be deprecated once log-failure-metric is up + # Send data point 1 to metric PublishNextFailure in prod us-east-1, if it's a failure runs-on: ubuntu-latest environment: ci needs: build-test @@ -162,9 +163,11 @@ jobs: value: 1 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 - log-success-metric: - # Send data point 0 to metric PublishNextFailure, if it's a success + log-success-metric-prod: + # to be deprecated once log-success-metric is up + # Send data point 0 to metric PublishNextFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: build-test @@ -177,3 +180,39 @@ jobs: value: 0 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + + log-failure-metric: + # Send data point 1 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure + runs-on: ubuntu-latest + environment: ci + needs: build-test + if: ${{ failure() }} + steps: + - name: Log failure data point to metric PublishNextFailure + # using absolute path here to avoid checking out the repo. Same as other absolute paths in this repo. + # Pattern: `{owner}/{repo}/.github/workflows/{filename}@{ref}`. + # more: https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishNextFailure + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 + + log-success-metric: + # Send data point 0 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success + runs-on: ubuntu-latest + environment: ci + needs: build-test + if: ${{ success() }} + steps: + - name: Log success data point to metric PublishNextFailure + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishNextFailure + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 diff --git a/.github/workflows/run-and-test-builds.yml b/.github/workflows/run-and-test-builds.yml index a5667117e35..65c41c4c939 100644 --- a/.github/workflows/run-and-test-builds.yml +++ b/.github/workflows/run-and-test-builds.yml @@ -101,8 +101,9 @@ jobs: NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }} VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }} - log-failure-metric: - # Send data point 1 to metricRunTimeTestsFailure, if it's a failure + log-failure-metric-prod: + # to be deprecated once log-failure-metric is up + # Send data point 1 to metricRunTimeTestsFailure in prod us-east-1, if it's a failure runs-on: ubuntu-latest environment: ci needs: build @@ -115,9 +116,11 @@ jobs: value: 1 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 - log-success-metric: - # Send data point 0 to metric RunTimeTestsFailure, if it's a success + log-success-metric-prod: + # to be deprecated once log-success-metric is up + # Send data point 0 to metric RunTimeTestsFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: build @@ -130,3 +133,36 @@ jobs: value: 0 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + + log-failure-metric: + # Send data point 1 to metricRunTimeTestsFailure in github-workflows@ us-east-2, if it's a failure + runs-on: ubuntu-latest + environment: ci + needs: build + if: ${{ failure() }} + steps: + - name: Log failure data point to metric RunTimeTestsFailure + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: RunTimeTestsFailure + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 + + log-success-metric: + # Send data point 0 to metric RunTimeTestsFailure in github-workflows@ us-east-2, if it's a success + runs-on: ubuntu-latest + environment: ci + needs: build + if: ${{ success() }} + steps: + - name: Log success data point to metric RunTimeTestsFailure + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: RunTimeTestsFailure + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-2 From 6b46f7f20dc1c7d372e1e47b8639bb6e9d45cda3 Mon Sep 17 00:00:00 2001 From: 0618 Date: Tue, 20 Sep 2022 13:32:04 -0700 Subject: [PATCH 2/5] chore: remove redundant space in comments --- .github/workflows/publish-latest.yml | 4 ++-- .github/workflows/publish-next.yml | 4 ++-- .github/workflows/run-and-test-builds.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml index ac437b182a1..ca6796c80a2 100644 --- a/.github/workflows/publish-latest.yml +++ b/.github/workflows/publish-latest.yml @@ -124,7 +124,7 @@ jobs: log-success-metric-prod: # to be deprecated once log-success-metric is up - # Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success + # Send data point 0 to metric PublishLatestFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: publish @@ -156,7 +156,7 @@ jobs: AWS_REGION: us-east-2 log-success-metric: - # Send data point 0 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a success + # Send data point 0 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a success runs-on: ubuntu-latest environment: ci needs: publish diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml index fcc039c5df6..dd0409ee53a 100644 --- a/.github/workflows/publish-next.yml +++ b/.github/workflows/publish-next.yml @@ -167,7 +167,7 @@ jobs: log-success-metric-prod: # to be deprecated once log-success-metric is up - # Send data point 0 to metric PublishNextFailure in prod us-east-1, if it's a success + # Send data point 0 to metric PublishNextFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: build-test @@ -202,7 +202,7 @@ jobs: AWS_REGION: us-east-2 log-success-metric: - # Send data point 0 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success + # Send data point 0 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success runs-on: ubuntu-latest environment: ci needs: build-test diff --git a/.github/workflows/run-and-test-builds.yml b/.github/workflows/run-and-test-builds.yml index 65c41c4c939..3b99800a86a 100644 --- a/.github/workflows/run-and-test-builds.yml +++ b/.github/workflows/run-and-test-builds.yml @@ -120,7 +120,7 @@ jobs: log-success-metric-prod: # to be deprecated once log-success-metric is up - # Send data point 0 to metric RunTimeTestsFailure in prod us-east-1, if it's a success + # Send data point 0 to metric RunTimeTestsFailure in prod us-east-1, if it's a success runs-on: ubuntu-latest environment: ci needs: build @@ -152,7 +152,7 @@ jobs: AWS_REGION: us-east-2 log-success-metric: - # Send data point 0 to metric RunTimeTestsFailure in github-workflows@ us-east-2, if it's a success + # Send data point 0 to metric RunTimeTestsFailure in github-workflows@ us-east-2, if it's a success runs-on: ubuntu-latest environment: ci needs: build From 7e6ff2a71aa7a9b12b3251465cdbd772497643db Mon Sep 17 00:00:00 2001 From: 0618 Date: Tue, 20 Sep 2022 13:48:20 -0700 Subject: [PATCH 3/5] refactor(gh-workflow): consolidate log-metric --- .github/workflows/publish-latest.yml | 25 ++++------------------- .github/workflows/publish-next.yml | 23 +++------------------ .github/workflows/run-and-test-builds.yml | 23 +++------------------ 3 files changed, 10 insertions(+), 61 deletions(-) diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml index ca6796c80a2..cc4a0fcbb9f 100644 --- a/.github/workflows/publish-latest.yml +++ b/.github/workflows/publish-latest.yml @@ -139,34 +139,17 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: us-east-1 - log-failure-metric: - # Send data point 1 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a failure + log-metric: + # Send data point to metric PublishLatestFailure in github-workflows@ us-east-2 runs-on: ubuntu-latest environment: ci needs: publish - if: ${{ failure() }} steps: - - name: Log failure data point to metric PublishLatestFailure + - name: Log data point to metric PublishLatestFailure uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: PublishLatestFailure - value: 1 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-2 - - log-success-metric: - # Send data point 0 to metric PublishLatestFailure in github-workflows@ us-east-2, if it's a success - runs-on: ubuntu-latest - environment: ci - needs: publish - if: ${{ success() }} - steps: - - name: Log success data point to metric PublishLatestFailure - uses: aws-amplify/amplify-ui/.github/actions/log-metric@main - with: - metric-name: PublishLatestFailure - value: 0 + value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} AWS_REGION: us-east-2 diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml index dd0409ee53a..72006cc11c7 100644 --- a/.github/workflows/publish-next.yml +++ b/.github/workflows/publish-next.yml @@ -182,12 +182,11 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: us-east-1 - log-failure-metric: - # Send data point 1 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure + log-metric: + # Send data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure runs-on: ubuntu-latest environment: ci needs: build-test - if: ${{ failure() }} steps: - name: Log failure data point to metric PublishNextFailure # using absolute path here to avoid checking out the repo. Same as other absolute paths in this repo. @@ -196,23 +195,7 @@ jobs: uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: PublishNextFailure - value: 1 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-2 - - log-success-metric: - # Send data point 0 to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success - runs-on: ubuntu-latest - environment: ci - needs: build-test - if: ${{ success() }} - steps: - - name: Log success data point to metric PublishNextFailure - uses: aws-amplify/amplify-ui/.github/actions/log-metric@main - with: - metric-name: PublishNextFailure - value: 0 + value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} AWS_REGION: us-east-2 diff --git a/.github/workflows/run-and-test-builds.yml b/.github/workflows/run-and-test-builds.yml index 3b99800a86a..92c16b5d068 100644 --- a/.github/workflows/run-and-test-builds.yml +++ b/.github/workflows/run-and-test-builds.yml @@ -135,34 +135,17 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: us-east-1 - log-failure-metric: - # Send data point 1 to metricRunTimeTestsFailure in github-workflows@ us-east-2, if it's a failure + log-metric: + # Send data point to metricRunTimeTestsFailure in github-workflows@ us-east-2, if it's a failure runs-on: ubuntu-latest environment: ci needs: build - if: ${{ failure() }} steps: - name: Log failure data point to metric RunTimeTestsFailure uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: RunTimeTestsFailure - value: 1 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-2 - - log-success-metric: - # Send data point 0 to metric RunTimeTestsFailure in github-workflows@ us-east-2, if it's a success - runs-on: ubuntu-latest - environment: ci - needs: build - if: ${{ success() }} - steps: - - name: Log success data point to metric RunTimeTestsFailure - uses: aws-amplify/amplify-ui/.github/actions/log-metric@main - with: - metric-name: RunTimeTestsFailure - value: 0 + value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} AWS_REGION: us-east-2 From 2b33798e47a9eb6fd0e39dd1cc41d7f5b47c769d Mon Sep 17 00:00:00 2001 From: 0618 Date: Tue, 20 Sep 2022 13:57:57 -0700 Subject: [PATCH 4/5] chore: remove redundant space in comments --- .github/workflows/publish-next.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml index 72006cc11c7..a924e65c2f7 100644 --- a/.github/workflows/publish-next.yml +++ b/.github/workflows/publish-next.yml @@ -147,7 +147,7 @@ jobs: log-failure-metric-prod: # to be deprecated once log-failure-metric is up - # Send data point 1 to metric PublishNextFailure in prod us-east-1, if it's a failure + # Send data point 1 to metric PublishNextFailure in prod us-east-1, if it's a failure runs-on: ubuntu-latest environment: ci needs: build-test @@ -183,7 +183,7 @@ jobs: AWS_REGION: us-east-1 log-metric: - # Send data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure + # Send data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure runs-on: ubuntu-latest environment: ci needs: build-test From 7fff2f9f0b913ac1f2dd4423128af1932b2da391 Mon Sep 17 00:00:00 2001 From: 0618 Date: Tue, 20 Sep 2022 21:56:08 -0700 Subject: [PATCH 5/5] fix(workflow): conditional statement syntax error --- .github/workflows/publish-latest.yml | 18 ++++++++++++++---- .github/workflows/publish-next.yml | 19 +++++++++++++------ .github/workflows/run-and-test-builds.yml | 16 +++++++++++++--- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml index cc4a0fcbb9f..3bb496fdb76 100644 --- a/.github/workflows/publish-latest.yml +++ b/.github/workflows/publish-latest.yml @@ -145,11 +145,21 @@ jobs: environment: ci needs: publish steps: - - name: Log data point to metric PublishLatestFailure + - name: Log failure data point to metric PublishLatestFailure + if: ${{ failure() }} + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishLatestFailure + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} + AWS_REGION: us-east-2 + - name: Log success data point to metric PublishLatestFailure + if: ${{ success() }} uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: PublishLatestFailure - value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} AWS_REGION: us-east-2 diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml index a924e65c2f7..08a4db70e11 100644 --- a/.github/workflows/publish-next.yml +++ b/.github/workflows/publish-next.yml @@ -189,13 +189,20 @@ jobs: needs: build-test steps: - name: Log failure data point to metric PublishNextFailure - # using absolute path here to avoid checking out the repo. Same as other absolute paths in this repo. - # Pattern: `{owner}/{repo}/.github/workflows/{filename}@{ref}`. - # more: https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow + if: ${{ failure() }} + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: PublishNextFailure + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} + AWS_REGION: us-east-2 + - name: Log success data point to metric PublishNextFailure + if: ${{ success() }} uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: PublishNextFailure - value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} AWS_REGION: us-east-2 diff --git a/.github/workflows/run-and-test-builds.yml b/.github/workflows/run-and-test-builds.yml index 92c16b5d068..0f7c67ba268 100644 --- a/.github/workflows/run-and-test-builds.yml +++ b/.github/workflows/run-and-test-builds.yml @@ -142,10 +142,20 @@ jobs: needs: build steps: - name: Log failure data point to metric RunTimeTestsFailure + if: ${{ failure() }} uses: aws-amplify/amplify-ui/.github/actions/log-metric@main with: metric-name: RunTimeTestsFailure - value: ${{ failure() && 1 || 0 }} # if failure, log 1; otherwise, log 0. ref: https://github.com/actions/runner/issues/409#issuecomment-727565588 - AWS_ACCESS_KEY_ID: ${{ secrets.METRIC_LOGGER_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.METRIC_LOGGER_SECRET_ACCESS_KEY }} + value: 1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} + AWS_REGION: us-east-2 + - name: Log success data point to metric RunTimeTestsFailure + if: ${{ success() }} + uses: aws-amplify/amplify-ui/.github/actions/log-metric@main + with: + metric-name: RunTimeTestsFailure + value: 0 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_METRIC_LOGGER }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_METRIC_LOGGER }} AWS_REGION: us-east-2