Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Check a folder if changed in the latest commit.
- * Returns true if changed, or false if no changes.
- */
- def checkFolderForDiffs(path) {
- try {
- // git diff will return 1 for changes (failure) which is caught in catch, or
- // 0 meaning no changes
- sh "git diff --quiet --exit-code HEAD~1..HEAD ${path}"
- return false
- } catch (err) {
- return true
- }
- }
- if ( checkFolderForDiffs('api/') ) {
- //API folder changed, run steps here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement