leomilrib/junkie

Possible not to require OAuth

Closed this issue · 1 comments

Bit off topic but just a question: So I've forked this repo for a project I'm working on (https://github.com/petems/puppet-community-open-prs)

I may have a misunderstanding of how the OAuth Github stuff works but I just wanted to check:

If I only wanted to do an Octokit check for public data, I wouldn't need to do the OAuth login at all right, because it would just use the token either from the ~/.netrc locally or the one I've generated for the app when hosting on Heroku. The OAuth is only required because we're looking at private repos and all organisations for the user to find all mentions correct?

So for my fork I could remove the OAuth login completely?

Yes, this is correct.

It is possible, using only:

client = Octokit::Client.new

and something like:

user = "your static user or organisation with open projects"
client.search_issues("user:#{user} is:pr is:open")

it will return the open issues for the open source projects from the specified user.

I tried this in a Ruby console:

[1] pry(main)> require 'octokit'
=> true
[2] pry(main)> c = Octokit::Client.new
=> #<Octokit::Client:0x000000032759e0 ...>
[3] pry(main)> c.search_issues("involves:petems is:pr is:open").first
=> [:total_count, 38]

So I think you would not even need to register the app this way, as you will only search thru a specific project and organisation.

In my case, I have closed projects in my organizations that I need to review and this would only be possible using a token from a registered GitHub app.

Feel free to ask anything else. See ya! 👋