Conversation
There was a problem hiding this comment.
Pull request overview
Updates the GitHub API artifact resolver to use Bearer token authentication instead of Basic auth, and refreshes tests/docs accordingly so users only need to provide a token (and tag) for private GitHub releases.
Changes:
- Switch
Nerves.Artifact.Resolvers.GithubAPIAuthorization header fromBasic ...toBearer .... - Update resolver tests to assert Bearer auth behavior.
- Update documentation and guides to remove
usernamefrom:github_apiexamples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/nerves/artifact/resolvers/github_api.ex |
Changes Authorization header construction to Bearer auth and removes :username from the struct. |
test/nerves/artifact/resolvers_github_api_test.exs |
Updates mocked header assertions from Basic to Bearer. |
lib/nerves/artifact.ex |
Updates :github_api example usage in docs. |
guides/advanced/systems.md |
Updates :github_api examples and wording to remove username. |
guides/advanced/customizing-systems.md |
Updates the list of supported artifact site helpers to remove username for :github_api. |
Comments suppressed due to low confidence (1)
lib/nerves/artifact/resolvers/github_api.ex:32
get/2builds the options struct viastruct(__MODULE__, opts), which raisesKeyErroron any unknown keys. Since this PR removes:usernamefrom the struct, existing callers that still passusername: ...(per previous docs) will now crash instead of being "ignored". To keep this change transparent, either keep:usernamein the struct (even if unused) or drop that key fromoptsbefore callingstruct/2.
def get({org_proj, opts}, dest_path) do
opts =
%{struct(__MODULE__, opts) | opts: opts, repo: org_proj}
|> maybe_adjust_token()
|> add_http_opts()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6bb65b3 to
0897e73
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
lib/nerves/artifact/resolvers/github_api.ex:31
- Removing
:usernamefrom the resolver struct is a breaking change for existing configs.get/2callsstruct(__MODULE__, opts), which raises ifoptscontains unknown keys (e.g.username:). If the intent is to transparently ignore usernames, either keepusernamein the struct for backward compatibility or drop:username(and any other deprecated keys) fromoptsbefore callingstruct/2(e.g. inget/2or inArtifact.expand_site/3).
defstruct artifact_name: nil,
base_url: @base_url,
headers: [],
public?: false,
opts: [],
repo: nil,
tag: "",
token: "",
url: nil
@impl Nerves.Artifact.Resolver
def get({org_proj, opts}, dest_path) do
opts =
%{struct(__MODULE__, opts) | opts: opts, repo: org_proj}
|> maybe_adjust_token()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is a transparent change to users. Bearer auth doesn't need the username, so it's ignored if users provide it.
fa05ea4 to
92e06e7
Compare
This is a transparent change to users. Bearer auth doesn't need the
username, so it's ignored if users provide it.