From 8c68cf2e0c7f7f61bcd53c436ab1057fcbc2a9f7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 26 Apr 2024 20:58:57 -0400 Subject: [PATCH] fixup - show diff and restrict pushing to only when in this PR pretty much --- .github/workflows/schemacode_ci.yml | 5 +++++ .github/workflows/validate_bids-examples.yml | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/schemacode_ci.yml b/.github/workflows/schemacode_ci.yml index fb03562b24..2db959e3b1 100644 --- a/.github/workflows/schemacode_ci.yml +++ b/.github/workflows/schemacode_ci.yml @@ -69,6 +69,11 @@ jobs: - 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 de5d245ee3..53c873d6ed 100644 --- a/.github/workflows/validate_bids-examples.yml +++ b/.github/workflows/validate_bids-examples.yml @@ -38,17 +38,25 @@ jobs: set -o pipefail tools/bids-2.0/apply_all 2>&1 | tee /tmp/patch.log - - name: "Push patched version online for possible introspection" - # if: contains(github.ref, 'refs/heads/bids-2.0') + - 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=$(git rev-parse --abbrev-ref HEAD)-patched + branch=${GITHUB_HEAD_REF}-patched git checkout -b "$branch" - git add . { - echo -e "Applied patches for BIDS-2.0 to $commit\n"; - cat /tmp/patch.log"; + echo -e "Applied patches for ${GITHUB_HEAD_REF} to ${commit}\n"; + cat /tmp/patch.log; } | git commit -F - git push -f origin "$branch"