From da554e15976fc7d04321fc0329a753b8c69811a3 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 26 Apr 2024 15:19:24 -0400 Subject: [PATCH] Adjust workflows to apply patches and push patched version as well for introspection --- .github/workflows/schemacode_ci.yml | 8 ++++++ .github/workflows/validate_bids-examples.yml | 29 ++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/.github/workflows/schemacode_ci.yml b/.github/workflows/schemacode_ci.yml index 6cf4dbcd4c..2db959e3b1 100644 --- a/.github/workflows/schemacode_ci.yml +++ b/.github/workflows/schemacode_ci.yml @@ -66,6 +66,14 @@ jobs: steps: - uses: actions/checkout@v4 + - name: "Apply patches for BIDS-2.0" + run: tools/bids-2.0/apply_all + + - name: "Show differences after patching" + run: | + git add . + git diff --cached + - name: "Set up Python" uses: actions/setup-python@v5 with: diff --git a/.github/workflows/validate_bids-examples.yml b/.github/workflows/validate_bids-examples.yml index 7911ad5c82..d7f3fbe476 100644 --- a/.github/workflows/validate_bids-examples.yml +++ b/.github/workflows/validate_bids-examples.yml @@ -33,6 +33,35 @@ jobs: steps: - uses: actions/checkout@v4 + - name: "Apply patches for BIDS-2.0" + run: | + set -o pipefail + tools/bids-2.0/apply_all 2>&1 | tee /tmp/patch.log + + - name: "Show differences after patching" + run: | + git add . + git diff --cached + + - name: "Commit and push patched version online for possible introspection" + # Run only on a non-merge commit for the PR + if: > + github.repository == 'bids-standard/bids-specification' && + github.event.pull_request.head.ref == 'bids-2.0' && + github.event.pull_request.merge_commit_sha != github.sha + run: | + set -x + commit=$(git rev-parse HEAD) + branch=${GITHUB_HEAD_REF}-patched + git config --global user.email "github-ci@example.com" + git config --global user.name "BIDS 2.0 GitHub CI" + git checkout -b "$branch" + { + echo -e "Applied patches for ${GITHUB_HEAD_REF} to ${commit}\n"; + cat /tmp/patch.log; + } | git commit -F - + git push -f origin "$branch" + # Setup Python with bst - uses: actions/setup-python@v5 with: