Skip to content

Commit 3afa582

Browse files
authored
refactor: 깃 푸시 경로 수정 및 커밋 메세지 수정 (#132)
1 parent 151fcd0 commit 3afa582

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/main/java/org/ezcode/codetest/application/submission/dto/request/github/GitHubPushRequest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ public static GitHubPushRequest of(SubmissionContext ctx, UserGithubInfo info, S
5959
public String getLanguage() {
6060
return languageName + " " + languageVersion;
6161
}
62+
63+
public String getProblemInfo() {
64+
return problemId + ". " + problemTitle;
65+
}
6266
}

src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class GitHubApiClient {
4343

4444
protected Optional<String> fetchSourceBlobSha(GitHubPushRequest req) {
4545
String fileName = FileType.SOURCE.resolveFilename(req);
46-
String path = String.format("%s/%s/%s/%s", repoRootFolder, req.difficulty(), req.problemId(), fileName);
46+
String path = String.format("%s/%s/%s/%s", repoRootFolder, req.difficulty(), req.getProblemInfo(), fileName);
4747

4848
return baseBuilder(req.accessToken())
4949
.get()
@@ -152,10 +152,10 @@ private String fetchBaseTreeSha(GitHubPushRequest req, String commitSha) {
152152

153153
private String createCommit(GitHubPushRequest req, String parentSha, String treeSha) {
154154
Map<String, Object> body = Map.of(
155-
"message", String.format("문제 %s. %s (%s) – 메모리: %sKB, 시간: %sms",
155+
"message", String.format("[%s] 문제 %s. %s, 메모리: %sKB, 시간: %sms",
156+
req.difficulty(),
156157
req.problemId(),
157158
req.problemTitle(),
158-
req.difficulty(),
159159
req.averageMemoryUsage(),
160160
req.averageExecutionTime()
161161
),

src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private List<Map<String, Object>> buildGitTreeEntriesFromMap(
6969
.map(s -> {
7070
FileType fileType = FileType.valueOf(s);
7171
String path = String.format("%s/%s/%s/%s",
72-
repoRootFolder, req.difficulty(), req.problemId(), fileType.resolveFilename(req)
72+
repoRootFolder, req.difficulty(), req.getProblemInfo(), fileType.resolveFilename(req)
7373
);
7474

7575
String content = fileType == FileType.SOURCE

0 commit comments

Comments
 (0)