Advertisement
Guest User

Untitled

a guest
Aug 26th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. /*
  2. * Check a folder if changed in the latest commit.
  3. * Returns true if changed, or false if no changes.
  4. */
  5. def checkFolderForDiffs(path) {
  6. try {
  7. // git diff will return 1 for changes (failure) which is caught in catch, or
  8. // 0 meaning no changes
  9. sh "git diff --quiet --exit-code HEAD~1..HEAD ${path}"
  10. return false
  11. } catch (err) {
  12. return true
  13. }
  14. }
  15.  
  16. if ( checkFolderForDiffs('api/') ) {
  17. //API folder changed, run steps here
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement