From 8913abe3002b1597eac4e859127dc7df2c7be738 Mon Sep 17 00:00:00 2001 From: Vanessa Sochat Date: Fri, 1 Feb 2019 13:02:19 -0500 Subject: [PATCH] testing using hub --- Dockerfile | 7 +++++-- pull-request.sh | 19 +++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index f830c69..a6a87c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ FROM debian:jessie-slim -# docker build -t vanessa/pull-request-action +# docker build -t vanessa/pull-request-action . LABEL "com.github.actions.name"="Pull Request on Branch Push" LABEL "com.github.actions.description"="Create a pull request when a branch is created or updated" LABEL "com.github.actions.icon"="activity" LABEL "com.github.actions.color"="yellow" -RUN apt-get update && apt-get install -y jq curl +RUN apt-get update && apt-get install -y jq curl wget +RUN wget https://github.com/github/hub/releases/download/v2.8.4/hub-linux-amd64-2.8.4.tgz && \ + tar -xzvf hub-linux-amd64-2.8.4.tgz +ENV PATH ${PATH}:/hub-linux-amd64-2.8.4/bin COPY pull-request.sh /pull-request.sh RUN chmod u+x /pull-request.sh diff --git a/pull-request.sh b/pull-request.sh index e3d7eec..f115d8f 100755 --- a/pull-request.sh +++ b/pull-request.sh @@ -47,19 +47,6 @@ check_events_json() { } -create_pull_request() { - - SOURCE=${1} # from this branch - TARGET=${2} # pull request TO this target - - TITLE="Update container ${SOURCE}" - BODY="This is an automated pull request to update the container collection ${SOURCE}" - - # Post the pull request - curl -d "{\"title\":\"${TITLE}\", \"body\":\"${BODY}\", \"head\":\"${SOURCE}\", \"base\":\"${TARGET}\"}" -H "Content-Type: application/json" -H "\"${HEADER}\"" -H \""${AUTH_HEADER}"\" -X POST ${PULLS_URL}; - echo $? -} - main () { @@ -95,7 +82,11 @@ main () { # Ensure we have a GitHub token check_credentials - create_pull_request $BRANCH $PULL_REQUEST_BRANCH + + TITLE="Update container ${BRANCH}" + BODY="This is an automated pull request to update the container collection ${BRANCH}" + + hub pull-request --base "${GITHUB_ACTOR}:${PULL_REQUEST_BRANCH}" --head "${GITHUB_ACTOR}:${BRANCH}" --message "${TITLE} ${BODY}" fi