diff --git a/install.sh b/install.sh index b7d56fb..49c0b86 100644 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ set -eu # allow overriding the version -VERSION=${CODECRAFTERS_CLI_VERSION:-v30} +VERSION=${CODECRAFTERS_CLI_VERSION:-v31} PLATFORM=$(uname -s) ARCH=$(uname -m) diff --git a/internal/commands/submit.go b/internal/commands/submit.go index 7bbcefd..c151944 100644 --- a/internal/commands/submit.go +++ b/internal/commands/submit.go @@ -91,7 +91,7 @@ func SubmitCommand(ctx context.Context) (err error) { logger.Debug().Msgf("creating submission for %s", commitSha) - createSubmissionResponse, err := codecraftersClient.CreateSubmission(codecraftersRemote.CodecraftersRepositoryId(), commitSha, "current_and_previous_descending") + createSubmissionResponse, err := codecraftersClient.CreateSubmission(codecraftersRemote.CodecraftersRepositoryId(), commitSha, "submit", "current_and_previous_descending") if err != nil { return fmt.Errorf("create submission: %w", err) } diff --git a/internal/commands/test.go b/internal/commands/test.go index eb341f3..480c401 100644 --- a/internal/commands/test.go +++ b/internal/commands/test.go @@ -111,7 +111,7 @@ func TestCommand(ctx context.Context, shouldTestPrevious bool) (err error) { stageSelectionStrategy = "current_and_previous_ascending" } - createSubmissionResponse, err := codecraftersClient.CreateSubmission(codecraftersRemote.CodecraftersRepositoryId(), tempCommitSha, stageSelectionStrategy) + createSubmissionResponse, err := codecraftersClient.CreateSubmission(codecraftersRemote.CodecraftersRepositoryId(), tempCommitSha, "test", stageSelectionStrategy) if err != nil { return fmt.Errorf("create submission: %w", err) } diff --git a/internal/utils/codecrafters_client.go b/internal/utils/codecrafters_client.go index 217b25e..145d822 100644 --- a/internal/utils/codecrafters_client.go +++ b/internal/utils/codecrafters_client.go @@ -88,12 +88,12 @@ func (c CodecraftersClient) headers() map[string]string { } } -func (c CodecraftersClient) CreateSubmission(repositoryId string, commitSha string, stageSelectionStrategy string) (CreateSubmissionResponse, error) { +func (c CodecraftersClient) CreateSubmission(repositoryId string, commitSha string, command string, stageSelectionStrategy string) (CreateSubmissionResponse, error) { response, err := grequests.Post(c.ServerUrl+"/services/cli/create_submission", &grequests.RequestOptions{ JSON: map[string]interface{}{ "repository_id": repositoryId, "commit_sha": commitSha, - "should_auto_advance": false, + "command": command, "stage_selection_strategy": stageSelectionStrategy, }, Headers: c.headers(),