diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2020-10-29 15:04:56 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-29 15:07:03 -0700 |
commit | 52f1dd5e7270dd78ae4ae246d583f2f7c6df0ba5 (patch) | |
tree | 83bf4752b7fa09fd58ab6ae804fd5403b4edbbb4 /tools/go_branch.sh | |
parent | a86f988a87e16910f1e6211d7b704e8bd92008f6 (diff) |
[infra] Deflake Go / generate (pull_request.
#4673 does not seem to work. Try this new approach.
PiperOrigin-RevId: 339754794
Diffstat (limited to 'tools/go_branch.sh')
-rwxr-xr-x | tools/go_branch.sh | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/go_branch.sh b/tools/go_branch.sh index 100c4ae41..9ce573872 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -61,14 +61,6 @@ go_branch=$( \ ) readonly go_branch -declare commit -commit=$(git rev-parse HEAD) -readonly commit -if [[ -n "$(git branch --contains="${commit}" go)" ]]; then - # The go branch already has the commit. - exit 0 -fi - # Clone the current repository to the temporary directory, and check out the # current go_branch directory. We move to the new repository for convenience. declare repo_orig @@ -130,7 +122,11 @@ find . -type f -exec chmod 0644 {} \; find . -type d -exec chmod 0755 {} \; # Update the current working set and commit. -git add . && git commit -m "Merge ${head} (automated)" +# If the current working commit has already been committed to the remote go +# branch, then we have nothing to commit here. So allow empty commit. This can +# occur when this script is run parallely (via pull_request and push events) +# and the push workflow finishes before the pull_request workflow can run this. +git add . && git commit --allow-empty -m "Merge ${head} (automated)" # Push the branch back to the original repository. git remote add orig "${repo_orig}" && git push -f orig go:go |