Skip to content

Commit

Permalink
ci: use pyTooling/Actions/with-post-step for commands in run and post…
Browse files Browse the repository at this point in the history
…-run
  • Loading branch information
rabi-siddique committed Aug 1, 2024
1 parent d69244b commit 24c19b4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 67 deletions.
29 changes: 5 additions & 24 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,29 +181,10 @@ runs:
mkdir -p node_modules/.cache/agoric
date > node_modules/.cache/agoric/yarn-built
# Refs: https://github.com/orgs/community/discussions/45342
- name: Validate Git Tree in Root Directory
if: inputs.path == '.'
uses: ./.github/actions/with-post-step
- name: Validate Git Tree Cleanliness
uses: pyTooling/Actions/with-post-step@v0.4.5
with:
main: echo "Checking Git tree for changes in the root directory..."
main: |
bash ${{ inputs.path }}/.github/actions/restore-node/check-git-status.sh ${{ inputs.path }}
post: |
set -x
if [ -n "$(git status --porcelain | grep -vE 'junit.xml$' | grep -vE '^[?][?] endo-sha.txt$|^.'; true)" ]; then
git status
echo "Unexpected dirty git status in default path" 1>&2
exit 1
fi
- name: Validate Git Tree in Agoric SDK Directory
if: inputs.path == './agoric-sdk'
uses: ./agoric-sdk/.github/actions/with-post-step
with:
main: echo "Checking Git tree for changes in the root directory..."
post: |
set -x
if [ -n "$(git status --porcelain | grep -vE 'junit.xml$' | grep -vE '^[?][?] endo-sha.txt$|^.'; true)" ]; then
git status
echo "Unexpected dirty git status in Agoric SDK path" 1>&2
exit 1
fi
bash ${{ inputs.path }}/.github/actions/restore-node/check-git-status.sh ${{ inputs.path }}
16 changes: 16 additions & 0 deletions .github/actions/restore-node/check-git-status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Navigate to the specified directory
cd $1
# Set verbose execution
set -x
# Check for unexpected changes
# Fail if git status detects changes, ignoring:
# - Files ending with 'junit.xml'
# - The untracked file 'endo-sha.txt'
# This setup ensures the Git status only flags unexpected modifications or untracked files outside these specified exceptions.
changes=$(git status --porcelain | grep -vE 'junit.xml$' | grep -vE '^\?\? endo-sha.txt$')
if [ -n "$changes" ]; then
git status
echo "Unexpected dirty git status in Agoric SDK path"
exit 1
fi
21 changes: 0 additions & 21 deletions .github/actions/with-post-step/action.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/actions/with-post-step/main.cjs

This file was deleted.

0 comments on commit 24c19b4

Please sign in to comment.