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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ jobs:
command: "compose up --project-name my-project"
```

### Disabling Output Capture

By default, the action captures the command's stdout as an output (`outputs.stdout`). For large deployments, this can exceed GitHub Actions' memory limits and cause the workflow to fail even though the deployment succeeded. If you don't need the stdout output, disable it:

```yaml
jobs:
test:
# [...]
steps:
# [...]
- name: Deploy
uses: DefangLabs/defang-github-action@v2
with:
capture-output: false
```

### Full Example

Here is a full example of a GitHub workflow that does everything we've discussed so far:
Expand Down
19 changes: 14 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ inputs:
description: "Allow upgrading the CD image and Pulumi version to the latest available"
required: false
default: "false"
capture-output:
description: "Capture the command's stdout as an output. Disable for large deployments to avoid GitHub Actions memory limits."
required: false
default: "true"

outputs:
stdout:
description: "The stdout of the command."
description: "The stdout of the command. Only available when capture-output is 'true'."
value: ${{ steps.command.outputs.stdout }}

runs:
Expand Down Expand Up @@ -188,13 +192,18 @@ runs:
unset $CONFIG_ENV_VARS_INIT_RANDOM $CONFIG_ENV_VARS dont_complain_on_empty

echo defang $COMMAND "${params[@]}"
output=$(defang $COMMAND "${params[@]}" | tee /dev/stderr)
echo "stdout<<DEFANG_EOF" >> "$GITHUB_OUTPUT"
echo "$output" >> "$GITHUB_OUTPUT"
echo "DEFANG_EOF" >> "$GITHUB_OUTPUT"
if [[ "$CAPTURE_OUTPUT" =~ ^(y|Y|yes|Yes|YES|true|True|TRUE|on|On|ON|1)$ ]]; then
output=$(defang $COMMAND "${params[@]}" | tee /dev/stderr)
echo "stdout<<DEFANG_EOF" >> "$GITHUB_OUTPUT"
echo "$output" >> "$GITHUB_OUTPUT"
echo "DEFANG_EOF" >> "$GITHUB_OUTPUT"
else
defang $COMMAND "${params[@]}"
fi
env:
COMMAND: ${{ inputs['command'] }}
COMPOSE_FILES: ${{ inputs['compose-files'] }}
CONFIG_ENV_VARS: ${{ inputs['config-env-vars'] }}
CONFIG_ENV_VARS_INIT_RANDOM: ${{ inputs['config-vars-init-random'] }}
CAPTURE_OUTPUT: ${{ inputs['capture-output'] }}

Loading