Skip to content

Commit eb4ae25

Browse files
committed
fix: address Greptile P1 and P2 feedback
1 parent f709e23 commit eb4ae25

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ services:
204204
condition: service_healthy
205205
environment:
206206
- GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD:-;asiweml@562}
207-
- GITLAB_OMNIBUS_CONFIG=gitlab_rails['initial_root_password'] = ENV['GITLAB_ROOT_PASSWORD']; gitlab_rails['gitlab_signup_enabled'] = false; gitlab_rails['allow_local_requests_from_web_hooks_and_services'] = true;
208207
entrypoint: /bin/sh
209208
command:
210209
- -c
@@ -218,7 +217,10 @@ services:
218217
219218
# Use OAuth2 password grant to get access token
220219
OAUTH_RESPONSE=$$(curl -s -X POST http://gitlab:80/oauth/token \
221-
-d "grant_type=password&username=root&password=$$GITLAB_ROOT_PASSWORD&scope=api")
220+
--data-urlencode "grant_type=password" \
221+
--data-urlencode "username=root" \
222+
--data-urlencode "password=$$GITLAB_ROOT_PASSWORD" \
223+
--data-urlencode "scope=api")
222224
echo "OAuth response: $$OAUTH_RESPONSE"
223225
224226
OAUTH_TOKEN=$$(echo "$$OAUTH_RESPONSE" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
@@ -230,7 +232,7 @@ services:
230232
PAT_RESPONSE=$$(curl -s -X POST http://gitlab:80/api/v4/users/1/personal_access_tokens \
231233
-H "Authorization: Bearer $$OAUTH_TOKEN" \
232234
-H "Content-Type: application/json" \
233-
-d '{"name":"bootstrap","scopes":["api","read_user","read_repository","write_repository"],"expires_at":"2027-01-01"}')
235+
-d '{"name":"bootstrap","scopes":["api","read_user","read_repository","write_repository"]}')
234236
echo "PAT response: $$PAT_RESPONSE"
235237
236238
TOKEN=$$(echo "$$PAT_RESPONSE" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)

src/VCS/Adapter/Git/GitLab.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public function createRepository(string $owner, string $repositoryName, bool $pr
107107
]);
108108

109109
$body = $response['body'] ?? [];
110+
$responseHeaders = $response['headers'] ?? [];
111+
$statusCode = $responseHeaders['status-code'] ?? 0;
112+
if ($statusCode >= 400) {
113+
throw new Exception("Creating repository {$repositoryName} failed with status code {$statusCode}");
114+
}
110115
return is_array($body) ? $body : [];
111116
}
112117

tests/VCS/Adapter/GitLabTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ public function testGetDeletedRepositoryFails(): void
113113
$this->vcsAdapter->getRepository(static::$owner, $repositoryName);
114114
}
115115

116-
// --- Override Base tests that use GitHub-hardcoded data ---
117-
118116
public function testGetPullRequestFromBranch(): void
119117
{
120118
$this->markTestSkipped('Not implemented for GitLab yet');
@@ -135,8 +133,6 @@ public function testCreateComment(): void
135133
$this->markTestSkipped('Not implemented for GitLab yet');
136134
}
137135

138-
// --- Skip abstract methods not yet implemented ---
139-
140136
public function testUpdateComment(): void
141137
{
142138
$this->markTestSkipped('Not implemented for GitLab yet');

0 commit comments

Comments
 (0)