Skip to content

Commit

Permalink
Push branch when successful cherry pick
Browse files Browse the repository at this point in the history
  • Loading branch information
himadrisingh committed Aug 11, 2020
1 parent 99a8275 commit 5d99157
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SHELL := /bin/bash
IMAGE = cherry-pick
TAG ?= $(shell git rev-parse --short HEAD)
DRY_RUN ?= false

.PHONY: build
build:
docker build -t ${IMAGE}:${TAG} .

.PHONY: run
run:
docker run -e GITHUB_TOKEN=${GITHUB_TOKEN} \
-e GITHUB_ACTOR=ops \
-e [email protected] \
-e DRY_RUN=${DRY_RUN} \
${IMAGE}:${TAG}
7 changes: 3 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ git_cmd() {
}

PR_BRANCH="auto-$GITHUB_SHA"
MESSAGE=$(git log -1 --format="%s" $GITHUB_SHA)
MESSAGE=$(git log -1 $GITHUB_SHA | grep "AUTO" | wc -l)

if [[ $MESSAGE =~ "AUTO" ]]; then
if [[ $MESSAGE -gt 0 ]]; then
echo "Autocommit, NO ACTION"
exit 0
fi
Expand All @@ -35,7 +35,6 @@ git_setup
git_cmd git remote update
git_cmd git fetch --all
git_cmd git checkout -b "${PR_BRANCH}" origin/"${INPUT_PR_BRANCH}"
git_cmd git push -u origin "${PR_BRANCH}"
git_cmd git cherry-pick "${GITHUB_SHA}"
git_cmd git push
git_cmd git push -u origin "${PR_BRANCH}"
git_cmd hub pull-request -b "${INPUT_PR_BRANCH}" -h "${PR_BRANCH}" -l "${INPUT_PR_LABELS}" -a "${GITHUB_ACTOR}" -m "\"AUTO: ${MESSAGE}\""

0 comments on commit 5d99157

Please sign in to comment.