try with curl

This commit is contained in:
Vanessa Sochat
2019-02-01 13:31:55 -05:00
parent 56f51766be
commit bb0828763b
2 changed files with 17 additions and 13 deletions

View File

@@ -8,9 +8,6 @@ LABEL "com.github.actions.icon"="activity"
LABEL "com.github.actions.color"="yellow"
RUN apt-get update && apt-get install -y jq curl wget git
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

View File

@@ -47,6 +47,21 @@ 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
DATA="{\"title\":\"${TITLE}\", \"base\":\"${TARGET}\", \"head\":\"${SOURCE}\"}"
echo "curl --user ${GITHUB_ACTOR} -X POST --data ${DATA} ${PULLS_URL}"
curl --user "${GITHUB_ACTOR}" -X POST --data "${DATA}" ${PULLS_URL}
echo $?
}
main () {
@@ -82,16 +97,8 @@ main () {
# Ensure we have a GitHub token
check_credentials
# Change to the GitHub repository
cd ${GITHUB_WORKSPACE}
echo "Present working directory with Git Workspace is ${PWD}"
git branch
TITLE="Update container ${BRANCH}"
BODY="This is an automated pull request to update the container collection ${BRANCH}"
hub pull-request --base "${PULL_REQUEST_BRANCH}" --head "${BRANCH}" --message "${TITLE}\n\n${BODY}"
hub pull-request --base ${GITHUB_ACTOR}:${PULL_REQUEST_BRANCH} --head ${GITHUB_ACT}:my-branch
create_pull_request $BRANCH $PULL_REQUEST_BRANCH
fi