Last active
September 21, 2020 15:21
-
-
Save nguyenthang98/dcc9a8a203d1c6a233cab6479c3bb755 to your computer and use it in GitHub Desktop.
git extract information
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 | |
| change_files="$(git diff --name-only HEAD HEAD~1 | xargs echo)" | |
| test_files=$@ | |
| for file in $test_files; do | |
| if [[ $change_files =~ (^|[[:space:]])"$file"($|[[:space:]]) ]]; then | |
| echo "contain file $file" | |
| else | |
| echo "not contain file $file" | |
| fi | |
| done |
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
| # view file changed in latest merge from last merge | |
| git log --merges --format="%H %ae"| head -n 2 | awk '{print $1}' | xargs git diff --name-only $1 $2 | |
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
| post { | |
| success { | |
| script { | |
| def merger_email = sh returnStdout: true, script: ' git log --merges -n 1 --format=%ae' | |
| def commiter_email = sh returnStdout: true, script: ' git log --no-merges -n 1 --format=%ae' | |
| mail bcc: '', subject: "Jenkins Job ${env.JOB_NAME}-${env.BUILD_DISPLAY_NAME} success", cc: commiter_email, from: '', replyTo: '', body: "Jenkin Build Success. Check it out: ${env.BUILD_URL}", to: merger_email | |
| } | |
| } | |
| cleanup { | |
| deleteDir() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment