Created
January 21, 2022 08:47
-
-
Save theowenyoung/e50d8f374a317fb974282d0533451159 to your computer and use it in GitHub Desktop.
Github Actions workflow file, check if there are uncommited changes
This file contains hidden or 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: Github Actions check if there are uncommited changes | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- run: touch index.html | |
- name: chown | |
run: sudo chown -R $USER:$USER ./ | |
- name: git config | |
run: git config --global user.name "github-actions[bot]" && git config --global user.email [email protected] | |
- name: git add | |
run: git add . | |
- run: git status | |
- id: isChanged | |
run: 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' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment