From 4fc2dde1767b4b3c3871b81c9a33bc89437b457e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Titsworth-Morin?= Date: Wed, 17 Jun 2026 11:34:13 +0000 Subject: [PATCH] feat: add capture-output input to prevent GHA memory limit failures Large deployments (e.g. Pulumi with many resources) can exceed GitHub Actions' memory limit when the full stdout is captured as a step output. This adds a `capture-output` input (default: true) that lets callers disable stdout capture when they don't need it. Co-Authored-By: Claude Opus 4.6 --- README.md | 16 ++++++++++++++++ action.yaml | 19 ++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) 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'] }}