Skip to content

add folder

add folder #15

name: Data Folder Validation
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
push:
branches:
- main
jobs:
validate_data_folders:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Set global validation_failed variable
id: set_validation_failed
run: echo "validation_failed=false" >> $GITHUB_ENV
- name: Check data folder
run: |
# Navigate to the data folder
cd data
# Check if the subfolders and sub-subfolders are correctly named
find . -type d -exec sh -c 'dir="{}"; if [ "$(ls -A "$dir" | wc -l)" -eq 0 ]; then if ! [[ "$(basename "$dir")" =~ ^[0-9][0-9]$ ]]; then echo "Invalid folder name: $dir"; echo "validation_failed=true" >> $GITHUB_ENV; fi; fi' \;
# Check for required files in the sub data folders
find . -type d -name '[0-9][0-9]' -exec sh -c 'dir="{}"; if [ ! -f "$dir/prompt.txt" ] || [ ! -f "$dir/output.txt" ] || [ ! -f "$dir/execution-result.txt" ] || [ ! -f "$dir/assessment.json" ]; then echo "Missing files in folder: $dir"; echo "validation_failed=true" >> $GITHUB_ENV; fi' \;
- name: Finalize workflow
run: |
if [ "${{ env.validation_failed }}" = "true" ]; then
echo "Validation failed."
exit 1
else
echo "Validation succeeded."
fi