-
Notifications
You must be signed in to change notification settings - Fork 1k
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
make a Credential class #8967
make a Credential class #8967
Conversation
Ok maybe now that I have to change all the specs I might regret it. |
@@ -0,0 +1,30 @@ | |||
# typed: strict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be strong
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strong gets mad that def_delegators
brings in untyped methods. I decided to punt on figuring that out or reimplementing them like with []
for now. I think the PR got large enough 😬
@jakecoffman Just a heads up that this also breaks anyone using the setup defined in dependabot-script. Any suggestions on how to set things up now, using the class? |
I hope it's this easy... diff --git a/dependabot-codecommit/dependabot.rb b/dependabot-codecommit/dependabot.rb
index 79c3430..b32cc46 100644
--- a/dependabot-codecommit/dependabot.rb
+++ b/dependabot-codecommit/dependabot.rb
@@ -6,6 +6,7 @@ require_relative "updater"
require_relative "client"
require_relative "utils"
+require "dependabot/credential"
require "dependabot/file_fetchers"
require "logger"
@@ -18,12 +19,12 @@ logger.level = Logger::INFO
error_set = Set[]
credentials = [
- {
+ Dependabot::Credential.new({
"type" => "git_source",
"host" => "github.com",
"username" => "x-access-token",
"password" => ENV["GITHUB_ACCESS_TOKEN"] # A GitHub access token with read access to public repos
- }
+ })
] |
Yes, looks like that did it! |
Since dependabot/dependabot-core#8967 in dependabot-core v0.243.0, the credential object is no longer just a hash. It now must be a Credential class.
credentials was incorrectly typed as a
T::Array[T::Hash[String,String]]
but because ofreplaces-base
it's actually aT::Array[T::Hash[String,T.any(T::Boolean,String)]]
.I thought since I have to touch all these places to change the type I could introduce a class instead to make it nicer.