Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
[추가] 검증 스크립트 추가 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
x-0o0 authored Jan 5, 2024
1 parent 1aed29c commit 9094153
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/scripts/GUARD_COMMITS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

TARGET_FILES=("swift-cinema/Sources/CinemaUI/MovieList.swift" "swift-cinema/Sources/CinemaUI/MovieRow.swift" "swift-cinema/Sources/CinemaUI/SubmissionDetailView.swift" "swift-cinema/Sources/Fetcher/Responses.swift" "swift-cinema/Tests/FetcherTests/MovieCollectionFetcherTests.swift" ".github/workflows/REVIEW_CODE.yml")

FIRST_COMMIT=$(git rev-list --max-parents=0 HEAD)

CHANGED_FILES=$(git diff -w --name-only $FIRST_COMMIT HEAD)

MODIFIED_TARGET_FILES=()
for TARGET_FILE in "${TARGET_FILES[@]}"; do
if [[ $CHANGED_FILES == *"$TARGET_FILE"* ]]; then
MODIFIED_TARGET_FILES+=("$TARGET_FILE")
fi
done

if [ ${#MODIFIED_TARGET_FILES[@]} -gt 0 ]; then
for MODIFIED_FILE in "${MODIFIED_TARGET_FILES[@]}"; do
echo "::warning:: $MODIFIED_FILE 에서 올바르지 않은 수정이 발견되었습니다."
done
fi

echo "커밋 가드 종료"
17 changes: 16 additions & 1 deletion .github/workflows/REVIEW_CODE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ concurrency:
cancel-in-progress: true

jobs:
guard-commits:
name: 커밋 검증을 시작합니다
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: 커밋 체크
run: |
chmod +x .github/scripts/GUARD_COMMITS.sh
.github/scripts/GUARD_COMMITS.sh
build-xcproject:
needs: guard-commits
name: 앱프로젝트를 빌드합니다
runs-on: macos-13
steps:
Expand All @@ -31,6 +45,7 @@ jobs:
build-package:
needs: guard-commits
name: 스위프트 패키지를 빌드 합니다
runs-on: macos-13
steps:
Expand All @@ -44,6 +59,7 @@ jobs:
test-package:
needs: guard-commits
name: 스위프트 패키지를 테스트 합니다
runs-on: macos-13
steps:
Expand All @@ -54,4 +70,3 @@ jobs:
run: |
cd swift-cinema
xcodebuild test -scheme FetcherTests -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest'

0 comments on commit 9094153

Please sign in to comment.