From 3935dea6cdb52159e4f9ddbfa9520f73ae4003eb Mon Sep 17 00:00:00 2001 From: yogyagamage <47789154+yogyagamage@users.noreply.github.com> Date: Sat, 30 Sep 2023 12:19:51 +0200 Subject: [PATCH] Fix issues with workflow files --- .github/workflows/validate-folder-structure.yml | 14 +++++++++----- .github/workflows/validate-json-data.yml | 10 ++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate-folder-structure.yml b/.github/workflows/validate-folder-structure.yml index e675d5e..3fa1545 100644 --- a/.github/workflows/validate-folder-structure.yml +++ b/.github/workflows/validate-folder-structure.yml @@ -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: | diff --git a/.github/workflows/validate-json-data.yml b/.github/workflows/validate-json-data.yml index b79e007..19e185c 100644 --- a/.github/workflows/validate-json-data.yml +++ b/.github/workflows/validate-json-data.yml @@ -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"}'