RevellNL Posted April 3, 2013 Share Posted April 3, 2013 (edited) Github workflow for Alfred v2 A configurable workflow for Alfred v2. 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. 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: repoThis returns a list of options for listing your repositories You can filter the results show by typing (part of) the repositoryname after the workflow command, f.e.: 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 April 7, 2013 by RevellNL Fogh and anazimok 2 Link to comment
vitor Posted April 3, 2013 Share Posted April 3, 2013 (edited) (…) 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 April 3, 2013 by Vítor RevellNL 1 Link to comment
RevellNL Posted April 4, 2013 Author Share Posted April 4, 2013 OAuth is definitely the way to go and I'll certainly be looking into it! For now I'm just going to be trying to make this works and have some nice functionality before I fix that though. Link to comment
RevellNL Posted April 4, 2013 Author Share Posted April 4, 2013 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
rice.shawn Posted April 4, 2013 Share Posted April 4, 2013 (edited) 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 April 4, 2013 by Shawn Rice Link to comment
RevellNL Posted April 5, 2013 Author Share Posted April 5, 2013 I'm working on the OAuth integration now, I have the flow laid out, now I just need to implement it. Should be fairly simple to do and with little to no effort needed from the user. Link to comment
RevellNL Posted April 5, 2013 Author Share Posted April 5, 2013 I've now implemented OAuth i.o. username/password. Check opening post for more information! Link to comment
vitor Posted April 5, 2013 Share Posted April 5, 2013 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 RevellNL 1 Link to comment
RevellNL Posted April 6, 2013 Author Share Posted April 6, 2013 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
RevellNL Posted April 7, 2013 Author Share Posted April 7, 2013 Workflow updated! Check out the opening post for more details! Link to comment
vitor Posted April 7, 2013 Share Posted April 7, 2013 (edited) 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 April 7, 2013 by Vítor Link to comment
RevellNL Posted April 8, 2013 Author Share Posted April 8, 2013 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
RevellNL Posted April 8, 2013 Author Share Posted April 8, 2013 (edited) 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 April 8, 2013 by RevellNL Link to comment
vitor Posted April 8, 2013 Share Posted April 8, 2013 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
RevellNL Posted April 10, 2013 Author Share Posted April 10, 2013 I've just updated the workflow with support for the Alleyoop updating mechanism, this will make updating the workflow in the future less cumbersome! Download the workflow update here (possibly the last time you'll have to download manually, yay!) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now