Jump to content

Recommended Posts

Github workflow for Alfred v2

A configurable workflow for Alfred v2.

screenshot-repo-list.png

Installation

You can install this workflow by dowloading the Github.alfredworkflow file and either double-clicking it, or dragging it onto the Alfred Workflow screen.

After adding it to your workflow collection, when you run the gh command in Alfred you will be presented with only two options; auth and token.

screenshot-no-auth.png

First, you'll need to choose for the auth option, this will generate an OAuth token for you which will be used by all subsequent calls to the Github API.

Once you get the OAuth token, copy it from the website, run gh token and paste the OAuth token in the Alfred window.

gh token thisisthetokenwhichcamefromthewebsite

 

Now you're all set to start using this workflow!

 

Usage

The initial command for starting this workflow is gh.

The commands currently supported by this workflow are:

  • repo
    This returns a list of options for listing your repositories screenshot-repo.png

You can filter the results show by typing (part of) the repositoryname after the workflow command, f.e.: screenshot-repo-list-filtered.png

 

If there's anything you run into which isn't working as you expect, or not working at all for some reason. Please, do let me know!

 

Also, be sure to check out the repository and maybe make some additions yourself!

Edited by RevellNL
Link to comment

(…) be sure to enter your own username and password in the script filter within the workflow. (These aren't stored anywhere outside of the script filter (…)

 

It can still be seen as a security risk (albeit only in very specific cases). Since it’s saved in plaintext, someone can still snoop around (not to mention it’ll probably be uploaded do Dropbox).

Maybe there’s an easy way to do it via OAuth.

Edited by Vítor
Link to comment

Had a quick look at integrating OAuth into the worklflow and it seems to be pretty simple, only thing is that you'll need to perform some manual steps in order to get the workflow to properly communicate with Github.
 
You'd have to authenticate via a github webpage after which you'll get redirected to a page under my control where a OAuth consumer key will be shown, this key would then have to be pasted into the Alfred workflow after which everything should work.
 
I don't really see this as a huge step, but I'm wondering what you guys think about this. Would you prefer to see the authentication go through OAuth (and perform the above steps once?), or would you prefer to just enter your credentials as it is now, in plain-text?

Link to comment

Maybe you could write a quick config AppleScript type thing that would create dialog boxes to enter in the credentials (then put in an action launched by something like "github configure"), and then you could encrypt the user and password from there.

Edited by Shawn Rice
Link to comment

When you have two commands (“gh” and “gh_auth”) people will constantly see the auth command when wanting to do the other, which in my view adds some unnecessary visual clutter (seeing as it’s a command that’ll only be run once).

I’d make a suggestion, which is similar to what I’ve implemented on PinAdd — make it an action modifier

AUntLTv.png

Link to comment

This crossed my mind as well. Another way I thought of this is to store the OAuth token in a separate file so it will be remembered after an update as well (currently it isn't), this way I can also check if that file is present, with content, and if so, I wont show the 'auth' command.

Link to comment

This crossed my mind as well. Another way I thought of this is to store the OAuth token in a separate file so it will be remembered after an update as well (currently it isn't), this way I can also check if that file is present, with content, and if so, I wont show the 'auth' command.

 

That’s also how I’ve set it up to work in PinAdd. Another advantage of it is that it’s also easier to update, since every time you want to push a new version you simply remove that file from the directory, instead of having to manually remove the key from the script.

Edited by Vítor
Link to comment

 

That’s also how I’ve set it up to work in PinAdd. Another advantage of it is that it’s also easier to update, since every time you want to push a new version you simply remove that file from the directory, instead of having to manually remove the key from the script.

You don't have to remove the key at all if you want to push a new version. I'm storing it in the non-volatile workflow directory (~/Library/Application Support/Alfred 2/Workflow Data/nl.jeroenseegers.Alfred.Github) so it will remain after updates as well and it won't get pushed with a new version!

Link to comment

Just pushed a minor update, ability to list watched repositories is now added.

 

Depending on the amount of repositories you own and have starred/watched the initial listing might take a while since the Github API doesn't respond that fast. After the initial call the repolists will be cached for 5 minutes by default.

Edited by RevellNL
Link to comment

You don't have to remove the key at all if you want to push a new version. I'm storing it in the non-volatile workflow directory (~/Library/Application Support/Alfred 2/Workflow Data/nl.jeroenseegers.Alfred.Github) so it will remain after updates as well and it won't get pushed with a new version!

 

You’re right. I prefer to store it in the workflow’s directory so it syncs, but I can certainly understand the decision to keep it there.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...