Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add support for artifacts uploaded by actions/upload-artifact@v4 #1791
Add support for artifacts uploaded by actions/upload-artifact@v4 #1791
Changes from 2 commits
31028a2
e5d19b8
c3b1be4
773391b
1d303f7
e22a29d
926998e
5b75ade
5557e97
07acfde
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Okay, I see what you're trying to do here. Looks good!
But I'd like moved to
GitHubClient.detectRedirect
.From what you described, authorization stripping is the behavior GitHub expects. That means, regardless of what
GitHubConnector
implementation is used, when the connector returns a redirect response this project must strip the Authorization header as appropriate and then follow the redirect. So, this functionality should go inGitHubClient
instead ofHttpClientGitHubConnector
.On the plus side,
GitHubClient
already has functionality for retries.github-api/src/main/java/org/kohsuke/github/GitHubClient.java
Lines 461 to 471 in 51b3a06
A retry exception can be thrown during error detection and the updated request contained in the exception will be used for the next attempt. We use this for token refresh, now we can use it for redirects. And we already detect redirects.
github-api/src/main/java/org/kohsuke/github/GitHubClient.java
Lines 508 to 535 in 51b3a06
Use
detectExpiredToken
as the template and replacedetectRedirect
with the logic you've implemented here.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.
I dunno both if it's worth it and if it's safe enough.
As for the former, as I said, I did my homework and all the other clients are having this behavior of stripping the
Authorization
header. So sure, we could add another client that wouldn't have this behavior at some point in the future but I also think it's probably better to let the client handle the redirects if it can do it properly.I also wanted to be very safe and carefully implement the rule of the Java HttpClient to make sure I wouldn't break anything.
Anyway, maybe you're right, I'm just not sure it's a decision that is so obvious.