Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ This action has the following outputs:

- `pull_request_url`: The URL of the pull request created by the workflow
- `pull_request_number`: The number of the pull request created by the workflow
- `pull_request_created`: Whether a new pull request was created (`true`) or an existing one was found (`false`)

## Permissions

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ outputs:
description: 'The URL of the pull request created by the workflow'
pull_request_number:
description: 'The number of the pull request created by the workflow'
pull_request_created:
description: 'Whether a new pull request was created (true) or an existing one was found (false)'

runs:
using: docker
Expand Down
12 changes: 10 additions & 2 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,13 @@ strategy:

## Outputs

### `pull_request_url`, `pull_request_number`
### `pull_request_url`, `pull_request_number`, `pull_request_created`

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.
There is a possibility to get the URL, number, and creation status of the Pull Request. You can use it in the next steps of your workflow.

- `pull_request_url`: The URL of the pull request created by the workflow
- `pull_request_number`: The number of the pull request created by the workflow
- `pull_request_created`: Whether a new pull request was created (`true`) or an existing one was found (`false`)

```yaml
# ...
Expand All @@ -488,6 +492,10 @@ There is a possibility to get the URL or number of the created Pull Request. You
run: gh pr --repo $GITHUB_REPOSITORY review ${{ steps.crowdin-download.outputs.pull_request_url }} --approve
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Notify about new PR
if: steps.crowdin-download.outputs.pull_request_created == 'true'
run: echo "A new pull request was created: ${{ steps.crowdin-download.outputs.pull_request_url }}"
```

## Tips and Tricks
Expand Down
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Default values for action outputs
echo "pull_request_url=" >> $GITHUB_OUTPUT
echo "pull_request_number=" >> $GITHUB_OUTPUT
echo "pull_request_created=false" >> $GITHUB_OUTPUT

if [ "$INPUT_DEBUG_MODE" = true ] || [ -n "$RUNNER_DEBUG" ]; then
echo '---------------------------'
Expand Down Expand Up @@ -160,6 +161,8 @@ create_pull_request() {
exit 1
fi

echo "pull_request_created=true" >> $GITHUB_OUTPUT

if [ -n "$INPUT_PULL_REQUEST_LABELS" ]; then
PULL_REQUEST_LABELS=$(echo "[\"${INPUT_PULL_REQUEST_LABELS}\"]" | sed 's/, \|,/","/g')

Expand Down