diff --git a/README.md b/README.md index 5eac2a6..df9d616 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/action.yaml b/action.yaml index 65ea613..9aef8ae 100644 --- a/action.yaml +++ b/action.yaml @@ -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: @@ -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<> "$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<> "$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'] }}