File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,20 @@ function toStr(obj) {
125
125
return JSON . stringify ( obj , null , 2 ) ;
126
126
}
127
127
128
+ function isRunningInGitHubActions ( ) {
129
+ return process . env . GITHUB_ACTIONS === 'true' ;
130
+ }
131
+
128
132
const DOWNLOAD_HISTORY_URL = "https://public-stats.phcode.io/generated/download_history.json" ;
129
133
async function getCurrentHistoryData ( ) {
134
+ if ( isRunningInGitHubActions ( ) ) {
135
+ // in github actions, there can be times when fetch fails in the automated hourly
136
+ // workflows. In that case we should fail early, else it will reset the history
137
+ // if we do try catch and return null. We dont want automated workflows resetting
138
+ // history.
139
+ const fetchedData = await fetch ( DOWNLOAD_HISTORY_URL ) ;
140
+ return fetchedData . json ( ) ;
141
+ }
130
142
try {
131
143
const fetchedData = await fetch ( DOWNLOAD_HISTORY_URL ) ;
132
144
return await fetchedData . json ( ) ;
You can’t perform that action at this time.
0 commit comments