How to check if there are uncommited changes in Github Actions?
name: Github Actions check if there are uncommited changeson:repository_dispatch:workflow_dispatch:push:branches:- mainjobs:test:runs-on: ubuntu-lateststeps:- name: Check out repository codeuses: actions/checkout@v2- run: touch index.html- name: chownrun: sudo chown -R $USER:$USER ./- name: git configrun: git config --global user.name "github-actions[bot]" && git config --global user.email github-actions-bot@users.noreply.github.com- name: git addrun: git add .- run: git status- id: isChangedrun: git diff-index --cached --quiet HEAD || echo '::set-output name=changed::true'- run: echo ${{ steps.isChanged.outputs.changed }}- if: ${{ steps.isChanged.outputs.changed == 'true' }}run: echo 'yes, changed'- if: ${{ steps.isChanged.outputs.changed != 'true' }}run: echo 'no any change'
Edit this page
Last updated on 1/21/2022