Skip to content

Commit

Permalink
Fix issues with workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
yogyagamage committed Sep 30, 2023
1 parent 09b0907 commit 3935dea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/validate-folder-structure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@ jobs:
- 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
# Flag to track validation status
validation_failed=false
# 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 "::set-env name=validation_failed::true"; fi; fi' \;
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 "::set-env name=validation_failed::true"; fi' \;
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: Check global validation_failed variable
run: echo "Validation failed status: ${{ env.validation_failed }}"

- name: Finalize workflow
run: |
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/validate-json-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ jobs:
validate-json:
runs-on: ubuntu-latest

strategy:
matrix:
file:
- $(find . -type f -name 'assessment.json')

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744

- name: Validate JSON files
uses: cardinalby/schema-validator-action@v3
with:
file: ${{ matrix.file }}
file: 'data/**/assessment.json'
schema: 'schemas/assessment.schema.json'
refSchemasMap: '{"https://github.com/ASSERT-KTH/lollm//blob/main/schemas/assessment.schema.json": "schemas/assessment.schema.json"}'

0 comments on commit 3935dea

Please sign in to comment.