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

🐛 github: fix precedence flag vs env-var #5144

Merged
merged 2 commits into from
Feb 4, 2025
Merged

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Jan 31, 2025

Github provider has two authentication methods.

  1. Application credentials
  2. Personal access token

We give precedence to the former and, if both auth methods are provided,
we will output a warning.

Closes #5036

Github provide has two authentication methods.

1. Application credentials
2. Personal access token

We give precedence to the former and, if both auth methods are provided,
we will output a warning.

Closes #5036

Signed-off-by: Salim Afiune Maya <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 31, 2025

Test Results

3 206 tests  ±0   3 202 ✅ ±0   1m 43s ⏱️ -9s
  385 suites ±0       4 💤 ±0 
   29 files   ±0       0 ❌ ±0 

Results for commit aa4f26c. ± Comparison against base commit 4c1b4a0.

♻️ This comment has been updated with latest results.

}
if token == "" && !isAppAuth {
return nil, errors.New("a valid GitHub authentication is required, pass --token '<yourtoken>', set GITHUB_TOKEN environment variable or provide GitHub App credentials")
}
if token != "" {
if isAppAuth {
log.Warn().Msg("both authentication methods provided, using application credentials")
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like here we warn that we're going to use the application credentials but then set the token as the credential? is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is correct. We can also NOT set it, it is a noop at this time so, more like a preference.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. i do find it confusing to set it if we're not using it, but things are working 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will not set it to avoid confusion. 👍🏽

@afiune afiune merged commit a1105d2 into main Feb 4, 2025
17 checks passed
@afiune afiune deleted the afiune/github-auth-fix branch February 4, 2025 21:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--token in GitHub provider should take precedence over GITHUB_TOKEN
2 participants