Share file or script to GitHub Gists



I’ve been working on a script that makes it easy to share files and scripts to GitHub Gists. I thought I wanted to share it, partly because I hope others can use it and partly because I think it’s a good example of performing a few actions with Scriptable including:

:bust_in_silhouette: Performing an OAuth flow.
:repeat: Using Scriptables URL scheme to implement x-callback-url in your scripts.
:closed_lock_with_key: Storing and accessing sensitive data using the Keychain API.

To use the script you must register an app on GitHub. It only takes two minutes and GitHub has a guide explaining how to do it:

After creating an app on GitHub, run the script and it will prompt you to enter the client ID and secret obtained after creating the app.

You can get the script from GitHub Gists:

Here’s a video that shows the script running:

I also made two shortcuts to go with the script. The first shortcut uses Scriptables URL scheme to create a gist from text or a file:

The second shortcut takes the URL to a gist as input and downloads the files in the gist.

Let me know if you experience any issues with the script or the shortcuts or if it’s useful to you :blush: