Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support to configure the GitHub access token to be used for GitHub API calls #605

Merged
merged 6 commits into from Jul 14, 2015

Conversation

guidomb
Copy link
Contributor

@guidomb guidomb commented Jul 7, 2015

fixes #603

To avoid Github rate limit issues now it is possible
to provide a Github API access token.

In shared environment where several virtual machines
are using the same public ip address (like travis ci),
carthage user could hit a Github API rate limit. By
providing a Github API access token, carthage can get
a higher rate limit.

To avoid Github rate limit issues now it is possible
to provide a Github API access token.

In shared environment where several virtual machines
are using the same public ip address (like travis ci),
carthage user could hit a Github API rate limit. By
providing a Github API access token, carthage can get
a higher rate limit.
@guidomb
Copy link
Contributor Author

guidomb commented Jul 7, 2015

You can check https://github.com/Wolox/ReactiveArray to see a running version of this patch in TravisCI

@mdiep
Copy link
Member

mdiep commented Jul 8, 2015

I have mixed feels about this. @Carthage/carthage?

@robrix
Copy link
Contributor

robrix commented Jul 8, 2015

Seems like maybe this shouldn’t be a command line argument, but maybe an environment variable?

@robb
Copy link
Member

robb commented Jul 8, 2015

The need is real, but I agree that an environment variable is probably the way to go here.

@mdiep
Copy link
Member

mdiep commented Jul 8, 2015

👍 to an environment variable.

@guidomb
Copy link
Contributor Author

guidomb commented Jul 8, 2015

I will remove the command line parameter and add support for the GITHUB_ACCESS_TOKEN env variable.

I wasn't sure about adding a the githubAccessToken parameter to this and this method. It just doesn't feel right but by adding the env variable all the logic needed to decided the authentication method can be encapuslated in the Github.swift file.

Should I amend the previous commit or add a new one?

@mdiep
Copy link
Member

mdiep commented Jul 8, 2015

New commits are preferred to rewriting history. 😄

@guidomb
Copy link
Contributor Author

guidomb commented Jul 8, 2015

Just replaced the command line argument for the env variable. Let me know if you want to change something else.

@guidomb guidomb changed the title Adds --github-access-token checkout option. Adds support to configure the GitHub access token to be used for GitHub API calls Jul 8, 2015
@@ -266,6 +284,14 @@ internal struct GitHubCredentials {
}
}

internal func loadGitHubCredentials(accessToken: GitHubAccessToken?) -> SignalProducer<GitHubCredentials?, CarthageError> {
if let accessToken = accessToken {
return SignalProducer(value: AccessTokenGitHubCredentials(accessToken: accessToken))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we read GITHUB_ACCESS_TOKEN here instead of passing it in? I think it's best to read it from CarthageKit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can definetly do that. My retaionale behind this was that for me the command line app is the one responsabile for obtaining the input (user or env) and feed that input to the CarthageKit lib.

@mdiep
Copy link
Member

mdiep commented Jul 13, 2015

I really like where this is headed—thanks for working on it! ✨ And sorry for the delayed review.

Guido Marucci Blas added 2 commits July 13, 2015 12:46
Instead of reading the env variable in the Carthage command
line application we do it inside CarthageKit.
@guidomb
Copy link
Contributor Author

guidomb commented Jul 14, 2015

@mdiep I've just commited the fixes we were discussing. Let me know if there is anything else. Should I amend all the commits before merge?

@@ -11,6 +11,7 @@ import Foundation
import Result
import ReactiveCocoa
import Runes
import Box
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for that I forgot to delete it. I was trying a different approch that didn't work and I left that. I am adding a new commit to fix it.

@mdiep
Copy link
Member

mdiep commented Jul 14, 2015

Should I amend all the commits before merge?

No, you don't need to amend the commits. We prefer history to be unaltered.

@mdiep
Copy link
Member

mdiep commented Jul 14, 2015

Thanks for all the work you put into this. It looks great! ✨

mdiep added a commit that referenced this pull request Jul 14, 2015
Adds support to configure the GitHub access token to be used for GitHub API calls
@mdiep mdiep merged commit d38ddcb into Carthage:master Jul 14, 2015
@ikesyo
Copy link
Member

ikesyo commented Jul 14, 2015

🎉

@guidomb guidomb deleted the github-access-token-option branch July 14, 2015 17:35
@robb
Copy link
Member

robb commented Aug 5, 2015

@mdiep would you mind building a new release including this feature?

@mdiep
Copy link
Member

mdiep commented Aug 5, 2015

@robb I'll try to do so in the next few days. I've been busy with a move, but would really like to get all the new bits out in the wild.

@guidomb
Copy link
Contributor Author

guidomb commented Aug 5, 2015

@mdiep I would be nice (if possible) to have #583 in the next release too. Thanks!

@mdiep
Copy link
Member

mdiep commented Aug 7, 2015

I just released 0.8: Llama Calculus. #583 didn't make it in, but I'll cut another release once the current batch of PRs is merged.

I haven't opened a PR for homebrew since I don't use it, but it'd be ✨ if someone wanted to do so.

@guidomb
Copy link
Contributor Author

guidomb commented Aug 7, 2015

@mdiep To open a PR for homebrew do we need to collaborators or anybody can do it? I've never released a brew formula before.

@mdiep
Copy link
Member

mdiep commented Aug 7, 2015

I think anybody, but I've never done it either. You should be able to search for Carthage in their PRs to find an example.

@guidomb
Copy link
Contributor Author

guidomb commented Aug 7, 2015

guidomb pushed a commit to guidomb/ios-scripts that referenced this pull request Aug 13, 2015
Carthage version 0.8 has been released and there is no need to
use a custom build because
Carthage/Carthage#605 is available now
adamkaplan added a commit to yahoo/YMCache that referenced this pull request Sep 10, 2015
@Blackjacx
Copy link

Hey any support for .env files to store the GITHUB_ACCESS_TOKEN? It feels unnecessary to do this each time we need to update our dependencies. It's better to store it in the .env file and let the carthage read this file like fastlane and many shell commands do it.

@mdiep
Copy link
Member

mdiep commented Jan 6, 2019

PRs welcome :)

@ikesyo
Copy link
Member

ikesyo commented Jan 6, 2019

Using direnv will be a possible solution.

@Blackjacx
Copy link

Oh thx, that’s a great tip 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure Github API token to avoid rate limit
6 participants