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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ You can also run any other Crowdin CLI command by specifying the `command` and `
with:
command: 'pre-translate'
command_args: '-l uk --method tm --branch main'

# Access the command output in subsequent steps (optional)
- name: Use command output
run: echo "${{ steps.crowdin.outputs.command_output }}"
```

To see the full list of available commands, visit the [official documentation](https://crowdin.github.io/crowdin-cli/).
Expand All @@ -227,6 +231,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`)
- `command_output`: The output of the Crowdin CLI command (only available when using the `command` input)

## Permissions

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ outputs:
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)'
command_output:
description: 'The output of the Crowdin CLI command when using the command input'

runs:
using: docker
Expand Down
11 changes: 10 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
echo "pull_request_url=" >> $GITHUB_OUTPUT
echo "pull_request_number=" >> $GITHUB_OUTPUT
echo "pull_request_created=false" >> $GITHUB_OUTPUT
echo "command_output=" >> $GITHUB_OUTPUT

if [ "$INPUT_DEBUG_MODE" = true ] || [ -n "$RUNNER_DEBUG" ]; then
echo '---------------------------'
Expand Down Expand Up @@ -364,7 +365,15 @@ fi

if [ -n "$INPUT_COMMAND" ]; then
echo "RUNNING COMMAND crowdin $INPUT_COMMAND $INPUT_COMMAND_ARGS"
crowdin $INPUT_COMMAND $INPUT_COMMAND_ARGS

# Capture command output while still displaying it
CROWDIN_OUTPUT=$(crowdin $INPUT_COMMAND $INPUT_COMMAND_ARGS)
echo "$CROWDIN_OUTPUT"

# Write multiline output to GITHUB_OUTPUT using heredoc delimiter
echo "command_output<<CROWDIN_EOF" >> $GITHUB_OUTPUT
echo "$CROWDIN_OUTPUT" >> $GITHUB_OUTPUT
echo "CROWDIN_EOF" >> $GITHUB_OUTPUT

# in this case, we don't need to continue executing any further default behavior
exit 0
Expand Down