Add option for building pull requests

This commit is contained in:
Lars Gohr
2019-09-07 21:02:59 +02:00
parent 91a3945f7b
commit a48ee1845e
3 changed files with 65 additions and 1 deletions

View File

@@ -27,6 +27,14 @@ if [ $(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g") != ${GITHUB_REF} ]; then
BRANCH="latest"
fi;
if [ $(echo ${GITHUB_REF} | sed -e "s/refs\/pull\///g") != ${GITHUB_REF} ]; then
if [ -z "${INPUT_PULL_REQUESTS}" ]; then
echo "The build was triggered within a pull request, but was not configured to build pull requests. Please see with.pull_requests"
exit 1
fi
BRANCH="pr$(echo ${GITHUB_REF} | sed -e "s/refs\/pull\///g" | sed -e "s/\///g")"
fi;
echo ${INPUT_PASSWORD} | docker login -u ${INPUT_USERNAME} --password-stdin ${INPUT_REGISTRY}
DOCKERNAME="${INPUT_NAME}:${BRANCH}"