feat: add step to verify changes before update contract #8
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: Update Contract | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-contract: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure Git Identity | |
run: | | |
git config --global user.email "alan.lanceloth@gmail.com" | |
git config --global user.name "Alan Lanceloth" | |
git config --get user.email | |
git config --get user.name | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check if there are any changes | |
id: verify_diff | |
run: | | |
cd contract | |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT | |
- name: Update Contract | |
if: steps.verify_diff.outputs.changed == 'true' | |
run: | | |
cd contract | |
git pull origin master || true | |
cd .. | |
git add contract | |
git commit -m "workflow: Update contract" | |
git push origin master |