File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed
Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change 2828 steps :
2929 - name : Checkout repository
3030 uses : actions/checkout@v5
31+ with :
32+ fetch-depth : 0
3133
3234 - name : Read assignment instructions
3335 id : instructions
@@ -180,19 +182,23 @@ jobs:
180182 java-version : ' 25'
181183
182184 - name : Check for modified files and test presence
183- id : code-check
184- run : |
185- # Check for test files
186- has_tests=$(find src/test/java -type f -name "*.java" | grep -q . && echo "true" || echo "false")
187-
188- # Check for modified files in src folders
189- git fetch origin main
190- changed_files=$(git diff --name-only origin/main...HEAD | grep -E '^src/(main|test)/java/.*\.java$' || true)
191- has_changes=$(test -n "$changed_files" && echo "true" || echo "false")
192-
193- echo "has_tests=$has_tests" >> $GITHUB_OUTPUT
194- echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
195- 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_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
196202
197203 - name: Compilation Check
198204 id: compilation-check
You can’t perform that action at this time.
0 commit comments