diff --git a/.github/workflows/maintain_cache.yml b/.github/workflows/maintain_cache.yml index 6160d3080..aa4b8ded9 100644 --- a/.github/workflows/maintain_cache.yml +++ b/.github/workflows/maintain_cache.yml @@ -51,17 +51,22 @@ jobs: set -e echo "Plugin cache updates exist" if [ ${{ endsWith(github.ref_name, '/main')}} ]; then - export MESSAGE="automatic $FILE_TO_COMMIT update" - export SHA=$( git rev-parse $DESTINATION_BRANCH:$FILE_TO_COMMIT ) - cat <<- EOF > request.json - { - "message": "$MESSAGE", - "content": "$( base64 -w 0 -i $FILE_TO_COMMIT )", + cat <<- EOF > write_request.py + #!python + import json + import os + request = { + "message": "automatic $FILE_TO_COMMIT update", + "content": os.environ["CONTENT"], "encoding": "base64", - "branch":" $DESTINATION_BRANCH", - "sha"= "$SHA" + "branch": "$DESTINATION_BRANCH", + "sha"= "$( git rev-parse $DESTINATION_BRANCH:$FILE_TO_COMMIT )", } + with open("request.json", "w", encoding="utf-8") as f: + json.dump(request, f, indent=4) EOF + chmod +x write_request.py + python write_request.py cat request.json gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT --input request.json echo "Update committed to repo"