Submodule Change Check #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Submodule Change Check | |
on: | |
workflow_dispatch: | |
jobs: | |
check_submodule: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "true" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.0 | |
registry-url: https://registry.npmjs.org/ | |
- name: Check for submodule changes | |
id: submodule_check | |
run: | | |
# Navigate to the submodule directory | |
cd packages/chain-registry/chain-registry | |
# Check if there are any differences between the submodule's HEAD and the commit recorded in the superproject | |
if git diff --exit-code HEAD..origin/main; then | |
echo "Submodule has not changed" | |
echo "CHANGED=false" >> $GITHUB_ENV | |
else | |
echo "Submodule has changed" | |
echo "CHANGED=true" >> $GITHUB_ENV | |
fi | |
- name: Run commands if submodule has changed | |
if: env.CHANGED == 'true' | |
run: | | |
echo "Running commands because the submodule has changed" | |
# Place your commands here |