diff --git a/codebuild/Makefile b/codebuild/Makefile index 332e181..5a44d09 100644 --- a/codebuild/Makefile +++ b/codebuild/Makefile @@ -323,22 +323,13 @@ GIST_HOST ?= github.e.it.census.gov sync-gist: check-env @[ -n "$(GITHUB_TOKEN)" ] || { echo "$(RED)ERROR: GITHUB_TOKEN is not set$(RESET)"; exit 1; } @echo "$(BOLD)Syncing codebuild/tf -> gist $(GIST_ID) on $(GIST_HOST)...$(RESET)" - @python3 -c " -import json, sys -content = open('tf').read() -print(json.dumps({'files': {'tf': {'content': content}}})) -" | curl -s -k -X PATCH \ - -H "Authorization: token $(GITHUB_TOKEN)" \ - -H "Content-Type: application/json" \ - -d @- \ - "https://$(GIST_HOST)/api/v3/gists/$(GIST_ID)" | python3 -c " -import json, sys -r = json.load(sys.stdin) -if 'id' in r: - print(' OK: gist/' + r['id'] + ' updated') -else: - print('ERROR: ' + json.dumps(r)); sys.exit(1) -" + @python3 -c "import json,sys; content=open('tf').read(); print(json.dumps({'files':{'tf':{'content':content}}}))" \ + | curl -s -k -X PATCH \ + -H "Authorization: token $(GITHUB_TOKEN)" \ + -H "Content-Type: application/json" \ + -d @- \ + "https://$(GIST_HOST)/api/v3/gists/$(GIST_ID)" \ + | python3 -c "import json,sys; r=json.load(sys.stdin); print(' OK: gist/'+r['id']+' updated') if 'id' in r else (print('ERROR: '+json.dumps(r)) or sys.exit(1))" # ── Internal helpers (not shown in help) ─────────────────────────────────────