diff --git a/.github/workflows/update_and_convert_schemas.yaml b/.github/workflows/update_and_convert_schemas.yaml index 74a2812..eeb680e 100644 --- a/.github/workflows/update_and_convert_schemas.yaml +++ b/.github/workflows/update_and_convert_schemas.yaml @@ -1,57 +1,57 @@ -name: Update schemas with changes - -on: - push: - branches-ignore: ["main"] - - -jobs: - update-schemas-with-changes: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Get complete history - - - name: Get latest push changes - id: changed-files - # if: github.base_ref != 'main' && github.event.action == 'synchronize' - uses: tj-actions/changed-files@v44 - with: - since_last_remote_commit: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: List all changed files - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - for file in "$ALL_CHANGED_FILES"; do - echo "$file was changed" - done - - - name: Install dependencies - run: pip install git+https://github.com/hed-standard/hed-python.git@develop - - - name: Update schemas - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - hed_update_schemas $ALL_CHANGED_FILES - - - name: Push schema changes - run: | - git config --global user.name 'GitHub Actions' - git config --global user.email 'actions@github.com' - git add . - if git diff --staged --quiet; then - echo "No changes to commit." - else - git commit -m "Automated schema changes" - git push - fi - +name: Update schemas with changes + +on: + push: + branches-ignore: ["main"] + + +jobs: + update-schemas-with-changes: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Get complete history + + - name: Get latest push changes + id: changed-files + # if: github.base_ref != 'main' && github.event.action == 'synchronize' + uses: tj-actions/changed-files@v45 + with: + since_last_remote_commit: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + for file in "$ALL_CHANGED_FILES"; do + echo "$file was changed" + done + + - name: Install dependencies + run: pip install git+https://github.com/hed-standard/hed-python.git@develop + + - name: Update schemas + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + hed_update_schemas $ALL_CHANGED_FILES + + - name: Push schema changes + run: | + git config --global user.name 'GitHub Actions' + git config --global user.email 'actions@github.com' + git add . + if git diff --staged --quiet; then + echo "No changes to commit." + else + git commit -m "Automated schema changes" + git push + fi + diff --git a/.github/workflows/validate_schemas.yaml b/.github/workflows/validate_schemas.yaml index edc17c0..1f2da38 100644 --- a/.github/workflows/validate_schemas.yaml +++ b/.github/workflows/validate_schemas.yaml @@ -1,45 +1,45 @@ -name: Validate schemas - -on: - push: - branches: ["*"] - pull_request: - branches: ["*"] - -jobs: - validate-schemas: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v44 - # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g - # with: - # since_last_remote_commit: true - - - name: List all changed files - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - for file in "$ALL_CHANGED_FILES"; do - echo "$file was changed" - done - - - name: Install dependencies - run: pip install git+https://github.com/hed-standard/hed-python.git@develop - - - name: Run command on file list - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - hed_validate_schemas $ALL_CHANGED_FILES +name: Validate schemas + +on: + push: + branches: ["*"] + pull_request: + branches: ["*"] + +jobs: + validate-schemas: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g + # with: + # since_last_remote_commit: true + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + for file in "$ALL_CHANGED_FILES"; do + echo "$file was changed" + done + + - name: Install dependencies + run: pip install git+https://github.com/hed-standard/hed-python.git@develop + + - name: Run command on file list + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + hed_validate_schemas $ALL_CHANGED_FILES diff --git a/.github/workflows/verify_source_branch.yaml b/.github/workflows/verify_source_branch.yaml index 83793a6..fad161b 100644 --- a/.github/workflows/verify_source_branch.yaml +++ b/.github/workflows/verify_source_branch.yaml @@ -22,7 +22,7 @@ jobs: - name: Get latest push changes id: changed-files - uses: tj-actions/changed-files@v44 + uses: tj-actions/changed-files@v45 with: since_last_remote_commit: true