try with curl
This commit is contained in:
@@ -8,9 +8,6 @@ LABEL "com.github.actions.icon"="activity"
|
|||||||
LABEL "com.github.actions.color"="yellow"
|
LABEL "com.github.actions.color"="yellow"
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y jq curl wget git
|
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
|
COPY pull-request.sh /pull-request.sh
|
||||||
|
|
||||||
RUN chmod u+x /pull-request.sh
|
RUN chmod u+x /pull-request.sh
|
||||||
|
|||||||
@@ -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 () {
|
main () {
|
||||||
|
|
||||||
@@ -82,16 +97,8 @@ main () {
|
|||||||
|
|
||||||
# Ensure we have a GitHub token
|
# Ensure we have a GitHub token
|
||||||
check_credentials
|
check_credentials
|
||||||
|
hub pull-request --base ${GITHUB_ACTOR}:${PULL_REQUEST_BRANCH} --head ${GITHUB_ACT}:my-branch
|
||||||
# Change to the GitHub repository
|
create_pull_request $BRANCH $PULL_REQUEST_BRANCH
|
||||||
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}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user