Created
April 9, 2024 13:25
-
-
Save lyashevska/82606d65075d3a26dd4f9080961a59e8 to your computer and use it in GitHub Desktop.
This file contains 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
""" | |
Purpose: this script creates GitHub gists for all files in a directory. | |
Adapted from | |
https://jels-boulangier.medium.com/automatically-create-github-gists-for-your-medium-articles-ba689775b032 | |
Usage: python create_gists.py <directory> | |
""" | |
import subprocess | |
import sys | |
from pathlib import Path | |
# Simple script which automatically creates GitHub gists using the GitHub CLI | |
# Note that you must be authenticated in the GitHub CLI | |
directory = Path(sys.argv[1]) | |
for file in directory.iterdir(): | |
subprocess.run(["gh", "gist", "create", "--public", file], check=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment