Skip to content

Instantly share code, notes, and snippets.

@steinbrueckri
Last active April 25, 2022 21:30
Show Gist options
  • Save steinbrueckri/9d5b45f5134caa6e680259179e7db091 to your computer and use it in GitHub Desktop.
Save steinbrueckri/9d5b45f5134caa6e680259179e7db091 to your computer and use it in GitHub Desktop.
Create file in GitHub Repo via API - Example
#!/bin/bash
MESSAGE="test"
TOKEN=$(cat ~/.github-token)
FILENAME="$RANDOM-date.txt"
CONTENT=$(date | base64)
USER="steinbrueckri"
REPO="api-test"
MESSAGE="hello world"
http PUT https://api.github.com/repos/$USER/$REPO/contents/$FILENAME \
Authorization:" token $TOKEN" \
message="$MESSAGE" \
content="$CONTENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment