Skip to content

Commit 59355ae

Browse files
06180618
andauthored
fix(github): workflow for log-metric (#2322)
* fix(github): workflow for log-metric * fix(github): log metric premature * chore(github): add comment for absolute path Co-authored-by: 0618 <[email protected]>
1 parent 1ad2a4c commit 59355ae

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.github/workflows/publish-latest.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ jobs:
9292
# Send data point 1 to metric PublishNPMFailure, if it's a failure
9393
runs-on: ubuntu-latest
9494
environment: ci
95+
needs: publish
9596
if: ${{ failure() }}
9697
steps:
9798
- name: Log failure data point to metric PublishNPMFailure
98-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
99+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
99100
with:
100101
metric-name: PublishNPMFailure
101102
value: 1
@@ -106,10 +107,11 @@ jobs:
106107
# Send data point 0 to metric PublishNPMFailure, if it's a success
107108
runs-on: ubuntu-latest
108109
environment: ci
110+
needs: publish
109111
if: ${{ success() }}
110112
steps:
111113
- name: Log success data point to metric PublishNPMFailure
112-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
114+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
113115
with:
114116
metric-name: PublishNPMFailure
115117
value: 0

.github/workflows/run-and-test-builds.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ jobs:
100100
# Send data point 1 to metricRunTimeTestsFailure, if it's a failure
101101
runs-on: ubuntu-latest
102102
environment: ci
103+
needs: build
103104
if: ${{ failure() }}
104105
steps:
105106
- name: Log failure data point to metric RunTimeTestsFailure
106-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
107+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
107108
with:
108109
metric-name: RunTimeTestsFailure
109110
value: 1
@@ -114,10 +115,11 @@ jobs:
114115
# Send data point 0 to metric RunTimeTestsFailure, if it's a success
115116
runs-on: ubuntu-latest
116117
environment: ci
118+
needs: build
117119
if: ${{ success() }}
118120
steps:
119121
- name: Log success data point to metric RunTimeTestsFailure
120-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
122+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
121123
with:
122124
metric-name: RunTimeTestsFailure
123125
value: 0

.github/workflows/test-deploy-main.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ jobs:
172172
# Send data point 1 to metric PublishNextFailure, if it's a failure
173173
runs-on: ubuntu-latest
174174
environment: ci
175+
needs: build-test
175176
if: ${{ failure() }}
176177
steps:
177178
- name: Log failure data point to metric PublishNextFailure
178-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
179+
# using absolute path here to avoid checking out the repo. Same as other absolute paths in this repo.
180+
# Pattern: `{owner}/{repo}/.github/workflows/{filename}@{ref}`.
181+
# more: https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow
182+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
179183
with:
180184
metric-name: PublishNextFailure
181185
value: 1
@@ -186,10 +190,11 @@ jobs:
186190
# Send data point 0 to metric PublishNextFailure, if it's a success
187191
runs-on: ubuntu-latest
188192
environment: ci
193+
needs: build-test
189194
if: ${{ success() }}
190195
steps:
191196
- name: Log success data point to metric PublishNextFailure
192-
uses: aws-amplify/amplify-ui/.github/actions/log-metric
197+
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
193198
with:
194199
metric-name: PublishNextFailure
195200
value: 0

0 commit comments

Comments
 (0)