Skip to content

Commit 67551cc

Browse files
committed
add success rate metric
1 parent 983eaa7 commit 67551cc

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/actions/workflow-metrics/action.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ runs:
3030
job_name="${job_name}(${{ matrix.os }})"
3131
fi
3232
33+
# Determine success/failure (1 for success, 0 for failure)
34+
if [ "${{ job.status }}" == "success" ]; then
35+
success_value=1
36+
else
37+
success_value=0
38+
fi
39+
3340
aws cloudwatch put-metric-data \
3441
--namespace "GitHub/Workflows" \
3542
--metric-data '[{
@@ -50,4 +57,24 @@ runs:
5057
"Value": "${{ github.repository }}"
5158
}
5259
]
53-
}]'
60+
},
61+
{
62+
"MetricName": "Success",
63+
"Value": '$success_value',
64+
"Unit": "Count",
65+
"Dimensions": [
66+
{
67+
"Name": "WorkflowName",
68+
"Value": "'${{ github.workflow }}'"
69+
},
70+
{
71+
"Name": "JobName",
72+
"Value": "'$job_name'"
73+
},
74+
{
75+
"Name": "Repository",
76+
"Value": "'${{ github.repository }}'"
77+
}
78+
]
79+
}
80+
]'

0 commit comments

Comments
 (0)