Share file or script to GitHub Gists

#1

Hi,

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: https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/

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: https://gist.github.com/simonbs/fdbed3dc051789291377cb174d4b338e

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: https://www.icloud.com/shortcuts/8a23c6da589a4e0787eb7c75005b3fe0

The second shortcut takes the URL to a gist as input and downloads the files in the gist. https://www.icloud.com/shortcuts/f00b6eba7d3d4a868fdd8893c56995ec

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

4 Likes