From 54561582e618852bf98df590ef94ee163c3253dc Mon Sep 17 00:00:00 2001 From: GlacierWalrus <114941647+GlacierWalrus@users.noreply.github.com> Date: Fri, 10 Feb 2023 15:00:33 +0000 Subject: [PATCH 1/3] Set PR_NUMBER when PR is created --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index cdd919f..63329f3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -169,6 +169,7 @@ if [[ -z "${PR_NUMBER}" ]]; then COMMAND="hub pull-request -b ${TARGET_BRANCH} -h ${SOURCE_BRANCH} --no-edit ${ARG_LIST[@]}" echo -e "\nRunning: ${COMMAND}" URL=$(sh -c "${COMMAND}") + PR_NUMBER=$(gh pr view --json number -q .number ${URL}) # shellcheck disable=SC2181 if [[ "$?" != "0" ]]; then RET_CODE=1; fi else From 77d9d4ab0beaaafa7f1c14e548c2a25bd0a62b46 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper Date: Sun, 12 Feb 2023 10:32:54 +0100 Subject: [PATCH 2/3] Bump release to v0.5.4 Preparation to merge https://github.com/devops-infra/action-pull-request/pull/114 --- Makefile | 2 +- README.md | 6 +++--- action.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5f9caa5..00703a8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ phony: help # Release tag for the action -VERSION := v0.5.3 +VERSION := v0.5.4 # GitHub Actions bogus variables GITHUB_REF ?= refs/heads/null diff --git a/README.md b/README.md index 89c1975..ac035c3 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Features: ```yaml - name: Run the Action - uses: devops-infra/action-pull-request@v0.5.3 + uses: devops-infra/action-pull-request@v0.5.4 with: github_token: ${{ secrets.GITHUB_TOKEN }} source_branch: development @@ -119,7 +119,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - name: Create pull request - uses: devops-infra/action-pull-request@v0.5.3 + uses: devops-infra/action-pull-request@v0.5.4 with: github_token: ${{ secrets.GITHUB_TOKEN }} title: Automatic pull request @@ -141,7 +141,7 @@ jobs: fetch-depth: 0 - name: Run the Action if: startsWith(github.ref, 'refs/heads/feature') - uses: devops-infra/action-pull-request@v0.5.3 + uses: devops-infra/action-pull-request@v0.5.4 with: github_token: ${{ secrets.GITHUB_TOKEN }} title: ${{ github.event.commits[0].message }} diff --git a/action.yml b/action.yml index 1417a69..a771c82 100644 --- a/action.yml +++ b/action.yml @@ -69,7 +69,7 @@ outputs: description: Pull request URL. runs: using: docker - image: docker://devopsinfra/action-pull-request:v0.5.3 + image: docker://devopsinfra/action-pull-request:v0.5.4 env: GITHUB_TOKEN: ${{ inputs.github_token }} branding: From 44c07826a739e00d0263a18339a10018f9df404d Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper Date: Sun, 12 Feb 2023 10:50:11 +0100 Subject: [PATCH 3/3] Fix order of executions to preserve return code --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 63329f3..cc72d2f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -169,9 +169,9 @@ if [[ -z "${PR_NUMBER}" ]]; then COMMAND="hub pull-request -b ${TARGET_BRANCH} -h ${SOURCE_BRANCH} --no-edit ${ARG_LIST[@]}" echo -e "\nRunning: ${COMMAND}" URL=$(sh -c "${COMMAND}") - PR_NUMBER=$(gh pr view --json number -q .number ${URL}) # shellcheck disable=SC2181 if [[ "$?" != "0" ]]; then RET_CODE=1; fi + PR_NUMBER=$(gh pr view --json number -q .number "${URL}") else echo -e "\nUpdating pull request" COMMAND="hub api --method PATCH repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER} --field 'body=@/tmp/template'"