Skip to content

Commit f6a2df8

Browse files
authored
Update classroom.yml
1 parent d8104cd commit f6a2df8

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

.github/workflows/classroom.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,23 @@ jobs:
182182
java-version: '25'
183183

184184
- name: Check for modified files and test presence
185-
id: code-check
186-
run: |
187-
# Ensure full history
188-
git fetch origin main
189-
git checkout ${{ github.ref_name }}
190-
git branch --set-upstream-to=origin/main ${{ github.ref_name }}
191-
192-
# Check for test files
193-
has_tests=$(find src/test/java -type f -name "*.java" | grep -q . && echo "true" || echo "false")
194-
195-
# Check for modified files
196-
changed_files=$(git diff --name-only origin/main...HEAD | grep -E '^src/(main|test)/java/.*\.java$' || true)
197-
has_changes=$(test -n "$changed_files" && echo "true" || echo "false")
198-
199-
echo "has_tests=$has_tests" >> $GITHUB_OUTPUT
200-
echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
201-
echo "should_grade=$([[ $has_tests == 'true' && $has_changes == 'true' ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
185+
id: code-check
186+
run: |
187+
# Ensure full history
188+
git fetch origin main
189+
git checkout "${GITHUB_REF##*/}"
190+
git branch --set-upstream-to=origin/main "${GITHUB_REF##*/}"
191+
192+
# Check for test files
193+
has_tests=$(find src/test/java -type f -name "*.java" | grep -q . && echo "true" || echo "false")
194+
195+
# Check for modified files
196+
changed_files=$(git diff --name-only origin/main...HEAD | grep -E '^src/(main|test)/java/.*\.java$' || true)
197+
has_changes=$(test -n "$changed_files" && echo "true" || echo "false")
198+
199+
echo "has_tests=$has_tests" >> $GITHUB_OUTPUT
200+
echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
201+
echo "should_grade=$([[ $has_tests == 'true' && $has_changes == 'true' ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
202202

203203
- name: Compilation Check
204204
id: compilation-check

0 commit comments

Comments
 (0)