walk-up-path/.github/workflows/commit-if-modified.sh
raw| 1 | #!/usr/bin/env bash |
| 2 | git config --global user.email "$1" |
| 3 | shift |
| 4 | git config --global user.name "$1" |
| 5 | shift |
| 6 | message="$1" |
| 7 | shift |
| 8 | if [ $(git status --porcelain "$@" | egrep '^ M' | wc -l) -gt 0 ]; then |
| 9 | git add "$@" |
| 10 | git commit -m "$message" |
| 11 | git push || git pull --rebase |
| 12 | git push |
| 13 | fi |