Skip to content

Commit

Permalink
workflow debug 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 6, 2023
1 parent 0f38f38 commit b31244b
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions .github/scripts/save-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mkdir $package_dir
unzip -q $PROJECT_NAME-$PLATFORM-$VERSION.zip

"$package_dir/pharo/bin/pharo" --headless $package_dir/image/$PROJECT_NAME.image eval "
| getResponse getContents downloads text timestamp filename putResponse |
| getResponse getContents downloads text timestamp filename body putResponse |
Transcript show: 'Getting download stats... '.
getResponse := ZnClient new
url:
Expand Down Expand Up @@ -55,33 +55,15 @@ timestamp := DateAndTime now asString.
filename := ((timestamp first: 19) copyReplaceAll: ':' with: '')
, '.csv'.
Transcript show: 'Uploading stats... '.
putResponse := ZnClient new
url:
'https://api.github.com/repos/openponk/$REPOSITORY_NAME/contents/'
, filename;
accept: ZnMimeType applicationJson;
setBearerAuthentication: '$GITHUB_TOKEN';
entity: (ZnEntity
with: '{
Transcript show: 'Saving put request body... '.
body := '{
\"content\":\"' , text asByteArray base64Encoded , '\",
\"message\":\"' , timestamp , '\",
\"branch\":\"dls\"
}'
type: ZnMimeType applicationJson);
put\";
response.
}'.
Transcript show: 'Checking upload went ok... '.
(putResponse status >= 300) ifTrue: [
self error: (String streamContents: [ :s |
s << 'Put response status ' << putResponse status asString << '.'.
putResponse status == 404 ifTrue: [
s
<<
' If this is the first build of this repository, manually create branch named dls (possibly with no files). This is whole body of response: '
<< putResponse entity contents ] ]) ].
Transcript show: 'Finished... '.
^ 'Uploaded ' , downloads asString , ' download count'\"
filename asFileReference writeStreamDo: [:s | s << body ].
Transcript show: 'Saved put request body... '.
"

curl -X PUT 'https://api.github.com/repos/openponk/$REPOSITORY_NAME/contents/$CSVFILENAME' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $GITHUB_TOKEN" -d `cat *.csv`

0 comments on commit b31244b

Please sign in to comment.