web services - How do I find all commits made by a certain user via GitHub API? -
Assuming that I have the necessary GitHub authentication credentials, how do I get all the commands made by a particular user?
Working Code
Below I wrote to you that the simplified coffee script implements the recommended strategy in the accepted answer. Except this snippet, the code is expected for the global variable configuration
, which should have a property user
, and a property token
A GitHub authentication token for the user said code also searches for command in a global meteor archive commits
maybe this code has bugs, but it works to at least some degree Of suggested improvements Is welcomed.
logger = new logger ("gitub") getResource = (Yuri, done) -> Option = auth: "Token: # {configuration.token}" header: "User-agent": "GeethHub comments" HTTP.call ("get", Yuri, option, made) getCommits = (user, user url, Time, done, page = 1, number quotes = 0) - & gt; Receiving event page # {pages} for eventsUrl = "# {userUrl} / events" page = # {page} "logger.debug (" user # {configuration.user} "}, eventsUrl) getResource (eventsUrl, (error , The result) -> If the error? Logger. Warne ("error", error) could not get the event for the new error ("user # # {configuration.user}") events = (event event in event.data Events for event events when event.type == "PushEvent" and & amp; event.pellload.com Mits.Lantal> 0) Commits [incident] event.payload.commits for events Event page for comm.author.email == user.email commits.push (Sha: commit.sha url: commit.url) found logger.debug ("## {commits.length} found # user user.email}" # {Pages} ") commands to logger.debug (" # {Commit.sha} to get details to commit ", commit.url) Commit = details = getResource (commit.url) Try DataGet Logger. Warne ("# {commit.url ;, Error Continue» Commits.insert (commit) ++ numCommits if result.data.length & gt; Call logger.debug ("call with call command command # # {comm commutes}" for next issue ") GetCommits (user, user url, time, done, page + 1, number commits) and done (numCommits) ) PollGitHub = - & gt; Logger.info ("GitHub voting for data") start = moment () userUrl = "https://api.github.com/users/#{configuration.user}" getResource (userUrl, (error, result) - & Error; Error; New error throwing (data can not be obtained for "user # # {configuration.user}") Users = ResultsData! User new error in email ("be able to identify user by email Throw ") .debug (" # {Removing all previous Commitments related to configuration.user "} Commits.remove (user: config) Grace. User) numCommits = 0 getCommits (user, user, start, (numCommits) -> took = moment () .diff (start, "seconds") logger.info ("insert # {numCommits} user # Configuration.user} takes seconds in seconds "))) Meteor.startup (-> PollGitHub ())
You can probably go through a few different routes:
Repos / Committee
Repeat users by means of Reops and earn for each
GET / user /: user / repo receive / Repo /: owner /: repo / commit
push event
received / user /: user / event
Any push at any time, a push event is triggered, because it should be pushed to see it, if you push any user issues If you are, you will see affiliate commits!
Comments
Post a Comment