summaryrefslogtreecommitdiffhomepage
path: root/tools/go_branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/go_branch.sh')
-rwxr-xr-xtools/go_branch.sh16
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/go_branch.sh b/tools/go_branch.sh
index 100c4ae41..71d036b12 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
@@ -117,7 +109,7 @@ EOF
# There are a few solitary files that can get left behind due to the way bazel
# constructs the gopath target. Note that we don't find all Go files here
# because they may correspond to unused templates, etc.
-declare -ar binaries=( "runsc" "shim/v1" "shim/v2" )
+declare -ar binaries=( "runsc" "shim/v1" "shim/v2" "webhook" )
for target in "${binaries[@]}"; do
mkdir -p "${target}"
cp "${repo_orig}/${target}"/*.go "${target}/"
@@ -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