Skip to content

Commit c953b17

Browse files
feat: add the 'pull_request_number' output (#216)
1 parent 38c22fc commit c953b17

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

EXAMPLES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [Separate PRs for each target language](#separate-prs-for-each-target-language)
1313
- [Checking out multiple branches in a single workflow](#checking-out-multiple-branches-in-a-single-workflow)
1414
- [Outputs](#outputs)
15-
- [`pull_request_url`](#pull_request_url)
15+
- [`pull_request_url`, `pull_request_number`](#pull_request_url-pull_request_number)
1616
- [Triggers](#triggers)
1717
- [Cron schedule](#cron-schedule)
1818
- [Manually](#manually)
@@ -451,9 +451,9 @@ strategy:
451451

452452
## Outputs
453453

454-
### `pull_request_url`
454+
### `pull_request_url`, `pull_request_number`
455455

456-
There is a possibility to get the URL of the created Pull Request. You can use it in the next steps of your workflow.
456+
There is a possibility to get the URL or number of the created Pull Request. You can use it in the next steps of your workflow.
457457

458458
```yaml
459459
# ...

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ When the workflow runs, the real values of your token and project ID will be inj
192192
This action has the following outputs:
193193

194194
- `pull_request_url`: The URL of the pull request created by the workflow
195+
- `pull_request_number`: The number of the pull request created by the workflow
195196

196197
## Permissions
197198

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ inputs:
214214
outputs:
215215
pull_request_url:
216216
description: 'The URL of the pull request created by the workflow'
217+
pull_request_number:
218+
description: 'The number of the pull request created by the workflow'
217219

218220
runs:
219221
using: docker

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Default values for action outputs
44
echo "pull_request_url=" >> $GITHUB_OUTPUT
5+
echo "pull_request_number=" >> $GITHUB_OUTPUT
56

67
if [ "$INPUT_DEBUG_MODE" = true ] || [ -n "$RUNNER_DEBUG" ]; then
78
echo '---------------------------'
@@ -93,6 +94,7 @@ create_pull_request() {
9394
if [[ $auth_status -eq 403 || "$auth_status" -eq 401 ]] ; then
9495
echo "FAILED TO AUTHENTICATE USING 'GITHUB_TOKEN' CHECK TOKEN IS VALID"
9596
echo "pull_request_url=" >> $GITHUB_OUTPUT
97+
echo "pull_request_number=" >> $GITHUB_OUTPUT
9698
exit 1
9799
fi
98100

@@ -139,6 +141,10 @@ create_pull_request() {
139141
echo "pull_request_url=$PULL_REQUESTS_URL" >> $GITHUB_OUTPUT
140142
fi
141143

144+
if [ -n "$PULL_REQUESTS_NUMBER" ]; then
145+
echo "pull_request_number=$PULL_REQUESTS_NUMBER" >> $GITHUB_OUTPUT
146+
fi
147+
142148
if [ "$PULL_REQUESTS_URL" = null ]; then
143149
echo "FAILED TO CREATE PULL REQUEST"
144150
echo "RESPONSE: ${PULL_RESPONSE}"

0 commit comments

Comments
 (0)