Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/#29_hunca
Browse files Browse the repository at this point in the history
  • Loading branch information
hun-ca committed Jun 9, 2024
2 parents e2d24a2 + 25801e9 commit cf0f1bb
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test with Ktlint
run: ./gradlew --info ktlintCheck
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ dependencies {
/** spring starter */
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
}
}
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,24 @@ tasks.create("buildDockerImage") {
}
}
}

/** git hooks */
tasks.register("gitExecutableHooks") {
doLast {
Runtime.getRuntime().exec("chmod -R +x .git/hooks/").waitFor()
}
}

tasks.register<Copy>("installGitHooks") {
val scriptDir = "${rootProject.rootDir}/scripts"
from("$scriptDir/pre-commit")
into("${rootProject.rootDir}/.git/hooks")
}

tasks.named("gitExecutableHooks").configure {
dependsOn("installGitHooks")
}

tasks.named("clean").configure {
dependsOn("gitExecutableHooks")
}
1 change: 0 additions & 1 deletion data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ dependencies {
implementation("org.flywaydb:flyway-core:${DependencyVersion.FLYWAY}")
implementation("org.flywaydb:flyway-mysql")
}

11 changes: 11 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 변경된 파일들 이름만 추출하여 저장
stagedFiles=$(git diff --staged --name-only)
# SpotlessApply 실행
echo "Running KtlintFormat. Formatting changed files."
./gradlew ktlintFormat
# 변경사항이 발생한 파일들 다시 git add
for file in $stagedFiles; do
if test -f "$file"; then
git add "$file"
fi
done

0 comments on commit cf0f1bb

Please sign in to comment.