Skip to content

22장 this - 테스트 #24

22장 this - 테스트

22장 this - 테스트 #24

Workflow file for this run

name: Check Changed Files in PR
on:
pull_request:
paths:
- '**/*' # 모든 경로에서 이벤트 감지
jobs:
check_changed_files:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Count Changed Files
id: count_files
run: |
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > temp.diff
changed_files=$(wc -l < temp.diff)
cat temp.diff
echo "Changed files count: $changed_files"
echo "::set-output name=changed_files::$changed_files"
- name: Check File Count
run: |
changed_files=${{ steps.count_files.outputs.changed_files }}
echo "Changed files count: $changed_files"
if [ $changed_files -eq 1 ]; then
echo "Only 1 file changed. Workflow continues."
else
echo "More than 1 file changed. Exiting the workflow."
exit 1
fi