Skip to content

Commit

Permalink
fix(codebuild): sync-gist recipe - collapse python to single lines (t…
Browse files Browse the repository at this point in the history
…ab compat)
  • Loading branch information
Your Name committed Mar 17, 2026
1 parent a921954 commit 5a644eb
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions codebuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) ─────────────────────────────────────

Expand Down

0 comments on commit 5a644eb

Please sign in to comment.