Skip to content

Instantly share code, notes, and snippets.

@dfischer
Last active August 16, 2018 11:52
Show Gist options
  • Select an option

  • Save dfischer/c8111a6a3563f2a17e7f1dea03c65871 to your computer and use it in GitHub Desktop.

Select an option

Save dfischer/c8111a6a3563f2a17e7f1dea03c65871 to your computer and use it in GitHub Desktop.
Gitlab.com deploy detect changes in folder
#!/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
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