Sign inSign up

marcoldp/gh-cli-create-pr

By marcoldp

•Updated about 5 years ago

Allows to create a GItHub PR from a container using the cli. Workaround to create PR in concourse.

Image
0

206

marcoldp/gh-cli-create-pr repository overview

⁠GH CLI create PR

This is meant to be used as a workaround because there's no available concourse resource to create a PR available.

It comes with a set of pre-requirements for our usecase: curl, jq and swagger binary

To use it you should launch a script job that uses this image and sets the following parameters:

ENV GITHUB_TOKEN=token
ENV GITHUB_REPO_NAME=cycloid-tests
ENV GITHUB_REPO_NAME=cycloid-tests
ENV GITHUB_BRANCH=pr_branch
ENV PR_TITLE="PR title"
ENV PR_BODY="PR body"
ENV PR_LABELS="Status: Need review" #a set of labels separated by comma

Then in the script you launch the following commands:

git clone -b ${GITHUB_BRANCH} https://${GITHUB_TOKEN}@github.com/${GITHUB_REPO_NAME}.git

cd "${GITHUB_REPO_NAME#*/}" && gh pr create --title ${PR_TITLE} --body ${PR_BODY} --label ${PR_LABELS}

To test locally you can run the following command, by defining an env file with the parameters previouslly explained:

docker run --rm -it --env-file env.env marcoldp/gh-cli-create-pr:${VERSION}

Note! You need to have a token with the following scopes: ['public_repo' ]

Tag summary

Content type

Image

Digest

Size

15.5 MB

Last updated

about 5 years ago

docker pull marcoldp/gh-cli-create-pr:1.0.3