Skip to content

Commit 61ae355

Browse files
committed
feat(upload): improve UNAUTHENTICATED error message
1 parent cdf0396 commit 61ae355

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/run/uploader/upload.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,20 @@ async fn retrieve_upload_data(
146146
.map(|body| body.error)
147147
.unwrap_or(text);
148148
if status == StatusCode::UNAUTHORIZED {
149-
let additional_message =
150-
if upload_metadata.run_environment == RunEnvironment::Local {
151-
"Run `codspeed auth login` to authenticate the CLI"
152-
} else {
149+
let additional_message = match upload_metadata.run_environment {
150+
RunEnvironment::GithubActions => {
151+
"Check that the workflow is correctly authenticated. View more at https://codspeed.io/docs/integrations/ci/github-actions/configuration#authentication"
152+
}
153+
RunEnvironment::GitlabCi => {
154+
"Check that the CI job is correctly authenticated. View more at https://codspeed.io/docs/integrations/ci/gitlab-ci/configuration#authentication"
155+
}
156+
RunEnvironment::Buildkite => {
153157
"Check that CODSPEED_TOKEN is set and has the correct value"
154-
};
158+
}
159+
RunEnvironment::Local => {
160+
"Run `codspeed auth login` to authenticate the CLI"
161+
}
162+
};
155163
error_message.push_str(&format!("\n\n{additional_message}"));
156164
}
157165

0 commit comments

Comments
 (0)