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

HomeWorkChecker

HomeWorkChecker #4

name: HomeWorkChecker
on:
push:
branches: [ " " ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
hw-checker-job:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Files changed:"
echo ${ALL_CHANGED_FILES}
ALL_CHANGED_FILES_ARR=(${ALL_CHANGED_FILES})
DIR_NAME="$(dirname ${ALL_CHANGED_FILES_ARR[0]})"
SAME_DIR=true
for file in "${ALL_CHANGED_FILES_ARR[@]}"; do
if [ "$DIR_NAME" != "$(dirname $file)" ]; then
SAME_DIR=false
break
fi
done
echo "All changed files are in the same directory: $SAME_DIR"
if [ "$SAME_DIR" = true ] ; then
echo "HW_DIR=$DIR_NAME" >> $GITHUB_ENV
exit 0
else
exit 1
fi
- name: Call the action kochaika/nand2tetris-grader
uses: kochaika/nand2tetris-grader@main
with:
dir: /github/workspace/${{ env.HW_DIR }}