Last active
August 16, 2018 11:52
-
-
Save dfischer/c8111a6a3563f2a17e7f1dea03c65871 to your computer and use it in GitHub Desktop.
Gitlab.com deploy detect changes in folder
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
| #!/bin/bash | |
| set -e | |
| export LAST_COMMIT=$( | |
| curl --header "Private-Token: $PRIV_TOKEN" https://gitlab.com/api/v4/projects/SOMEPROJECT/pipelines | jq -e -r '[.[] | select(.ref=="master") ] | .[1].sha' | |
| ) | |
| if [[ $(git diff $LAST_COMMIT --name-only | grep admin) ]]; then | |
| echo admin deploying, detected changes | |
| else | |
| echo admin deploy skipped, no changes detected | |
| fi |
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
| Change $PRIVATE_TOKEN to your personal access token. | |
| Modify JQ rules based on what you need. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment