Skip to content

Commit

Permalink
Fix status code check (#3791)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Mar 1, 2024
1 parent 61f4495 commit 118c5f1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ abstract class GitHubAPI {
int responseCode = 0;
int attemptNumber = 1;
int maxAttempts = 3;
while (responseCode != HttpURLConnection.HTTP_CREATED) {
while (responseCode != HttpURLConnection.HTTP_NO_CONTENT) {
HttpURLConnection conn = (HttpURLConnection) url.openConnection()

// The GitHub API doesn't do an auth challenge
Expand All @@ -131,7 +131,7 @@ abstract class GitHubAPI {
osw.close()
responseCode = conn.getResponseCode()

if (responseCode != HttpURLConnection.HTTP_CREATED) {
if (responseCode != HttpURLConnection.HTTP_NO_CONTENT) {
if (attemptNumber == maxAttempts) {
LOGGER.log(Level.WARNING, "Failed to create/update secret ${name} for ${repositoryName}, response code: ${responseCode}")
break;
Expand Down

0 comments on commit 118c5f1

Please sign in to comment.