Skip to content

Commit

Permalink
Dont fail on missing permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgrefer committed Jul 9, 2022
1 parent 4b22ee7 commit 8218b2f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.TaskExecutionException;
import retrofit2.Call;
import retrofit2.Response;

Expand Down Expand Up @@ -43,7 +42,8 @@ public void upload() {
GithubService githubService = githubClient.getGithubService();

try (FileReader fileReader = new FileReader(getSnapshotFile().getAsFile().get())) {
Snapshot snapshot = new Gson().fromJson(fileReader, Snapshot.class);
Gson gson = new Gson();
Snapshot snapshot = gson.fromJson(fileReader, Snapshot.class);
getLogger().lifecycle("Job: {}", snapshot.getJob());
getLogger().lifecycle("Ref: {}, Sha: {}", snapshot.getRef(), snapshot.getSha());
getLogger().info("Detector: {}", snapshot.getDetector());
Expand All @@ -54,6 +54,10 @@ public void upload() {
if (execute.isSuccessful()) {
getLogger().lifecycle(execute.body().getMessage());
}
else if (execute.code() == 403) {
getLogger().warn("Upload Failed due to missing permissions");
getLogger().info(execute.errorBody().string());
}
else {
getLogger().error("{} {}", execute.code(), execute.message());
getLogger().error(execute.errorBody().string());
Expand Down

0 comments on commit 8218b2f

Please sign in to comment.