Skip to content

Commit

Permalink
Merge pull request #86 from devops-infra/feature/create-file
Browse files Browse the repository at this point in the history
Use a file as source for creating PR
  • Loading branch information
ChristophShyper authored Apr 20, 2022
2 parents c01da33 + b3f7911 commit 033d84a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ if [[ -z "${PR_NUMBER}" ]]; then
TITLE=$(git log -1 --pretty=%s | head -1)
fi
ARG_LIST=()
ARG_LIST+=("-m \"${TITLE}\"")
ARG_LIST+=("-m \"${TEMPLATE}\"")
ARG_LIST+=("-F /tmp/template")
if [[ -n "${INPUT_REVIEWER}" ]]; then
ARG_LIST+=("-r \"${INPUT_REVIEWER}\"")
fi
Expand All @@ -157,11 +156,13 @@ fi

if [[ -z "${PR_NUMBER}" ]]; then
echo -e "\nCreating pull request"
echo -e "${TITLE}" > /tmp/template
echo -e "\n${TEMPLATE}" >> /tmp/template
echo -e "\nTemplate:"
cat /tmp/template
# shellcheck disable=SC2016
COMMAND="hub pull-request -b ${TARGET_BRANCH} -h ${SOURCE_BRANCH} --no-edit ${ARG_LIST[@]}"
# shellcheck disable=SC2001
COMMAND=$(echo -e "${COMMAND}" | sed 's/\`/\\`/g')
echo -e "Running: ${COMMAND}"
echo -e "\nRunning: ${COMMAND}"
URL=$(sh -c "${COMMAND}")
# shellcheck disable=SC2181
if [[ "$?" != "0" ]]; then RET_CODE=1; fi
Expand Down

0 comments on commit 033d84a

Please sign in to comment.