Created
August 4, 2022 14:38
-
-
Save amithgc/1c4dbb43b07340a58e0c4d391d782440 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate a Github Personal Access token and use it here | |
API_TOKEN="<YOUR GITHUB TOKEN>" | |
#Update the URL Below | |
GITHUB_URL="https://api.github.com/repos/<USER NAME>/<REPO NAME>" | |
# Getting the Base64 for your image | |
base64Data=$( base64 Capture.jpg ) | |
#Getting the current timestamp to rename your uploading image | |
timestamp=$(date +%s) | |
#Uploading the Image | |
curl --location --request PUT $GITHUB_URL'/contents/images/'$timestamp'.jpg' \ | |
--header 'Authorization: token '$API_TOKEN \ | |
--header 'Content-Type: text/plain' \ | |
--data-raw '{"message":"Image Pushed","committer":{"name":"Amith","email":"[email protected]"},"content":"'$base64Data'"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment