Skip to content

Commit

Permalink
Merge pull request #106 from devops-infra/feature/pr-number
Browse files Browse the repository at this point in the history
Add pr_number to outputs
  • Loading branch information
ChristophShyper authored Nov 3, 2022
2 parents 2dea7a8 + 2af0cab commit 78bacf8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
phony: help

# Release tag for the action
VERSION := v0.5.0
VERSION := v0.5.2

# GitHub Actions bogus variables
GITHUB_REF ?= refs/heads/null
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Features:

```yaml
- name: Run the Action
uses: devops-infra/action-pull-request@v0.5.0
uses: devops-infra/action-pull-request@v0.5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: development
Expand Down Expand Up @@ -78,9 +78,10 @@ Features:
| title | No | *subject of the first commit* | Pull request title. |


| Outputs | Description |
| ------- | ---------------- |
| url | Pull request URL |
| Outputs | Description |
| --------- | ----------------------------- |
| url | Pull request URL |
| pr_number | Number of GitHub pull request |


### How get_diff works
Expand Down Expand Up @@ -118,7 +119,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create pull request
uses: devops-infra/action-pull-request@v0.5.0
uses: devops-infra/action-pull-request@v0.5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
title: Automatic pull request
Expand All @@ -140,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.0
uses: devops-infra/action-pull-request@v0.5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
title: ${{ github.event.commits[0].message }}
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ outputs:
description: Pull request URL.
runs:
using: docker
image: docker://devopsinfra/action-pull-request:v0.5.0
image: docker://devopsinfra/action-pull-request:v0.5.2
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
branding:
Expand Down
7 changes: 5 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ if [[ -z "${PR_NUMBER}" ]]; then
echo -e "\n${TEMPLATE}" >> /tmp/template
echo -e "\nTemplate:"
cat /tmp/template
# shellcheck disable=SC2016
# shellcheck disable=SC2016,SC2124
COMMAND="hub pull-request -b ${TARGET_BRANCH} -h ${SOURCE_BRANCH} --no-edit ${ARG_LIST[@]}"
echo -e "\nRunning: ${COMMAND}"
URL=$(sh -c "${COMMAND}")
Expand All @@ -181,7 +181,10 @@ else
fi

# Finish
echo "::set-output name=url::${URL}"
{
echo "url=${URL}"
echo "pr_number=${PR_NUMBER}"
} >> "$GITHUB_OUTPUT"
if [[ ${RET_CODE} != "0" ]]; then
echo -e "\n[ERROR] Check log for errors."
exit 1
Expand Down

0 comments on commit 78bacf8

Please sign in to comment.