Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ For example:

## Available Actions

All actions support the `DEFAULT_ACCOUNT_ID` and `DEFAULT_PERSONAL_ACCESS_KEY`, and `DEFAULT_CLI_VERSION` env variables. There's no need to pass them into each action individually as inputs.
All actions support the `DEFAULT_ACCOUNT_ID`, `DEFAULT_PERSONAL_ACCESS_KEY`, `DEFAULT_CLI_VERSION`, and `DEFAULT_DEBUG` env variables. There's no need to pass them into each action individually as inputs.

**TIP:** Set `DEFAULT_DEBUG: true` or pass `debug: true` to any action to enable verbose CLI output. This is useful for troubleshooting failures.

### `Project Upload`

Expand Down
1 change: 1 addition & 0 deletions project-deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Deploys a specific build of a HubSpot project.
- `account_id` (optional): HubSpot account ID associated with the personal access key. If not provided, will use DEFAULT_ACCOUNT_ID from environment.
- `cli_version` (optional): Version of the HubSpot CLI to install. If not provided, will look for `DEFAULT_CLI_VERSION` in environment. If neither are found, defaults to a pre-determined stable version of the CLI.
- `profile` (optional): Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment.
- `debug` (optional): Enable debug mode for verbose CLI output. Useful for troubleshooting deploy failures. If not provided, will use DEFAULT_DEBUG from environment. Defaults to `false`.

**Outputs:**

Expand Down
13 changes: 12 additions & 1 deletion project-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
description: "Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment."
required: false
type: string
debug:
description: "Enable debug mode for HubSpot CLI commands. Passes --debug flag to all hs commands. If not provided, will use DEFAULT_DEBUG from environment."
required: false
type: boolean
outputs:
deploy_id:
description: The deploy ID of the initiated HubSpot project deploy
Expand All @@ -46,6 +50,7 @@ runs:
HUBSPOT_PERSONAL_ACCESS_KEY: ${{ inputs.personal_access_key || env.DEFAULT_PERSONAL_ACCESS_KEY }}
HUBSPOT_ACCOUNT_ID: ${{ inputs.account_id || env.DEFAULT_ACCOUNT_ID }}
HUBSPOT_PROFILE: ${{ inputs.profile || env.DEFAULT_PROFILE }}
DEBUG_MODE: ${{ inputs.debug || env.DEFAULT_DEBUG}}
run: |
# Source shared utilities
. "$GITHUB_ACTION_PATH/../scripts/action-utils.sh"
Expand Down Expand Up @@ -78,9 +83,15 @@ runs:
BUILD_ARG="--build ${{ inputs.build_id }}"
fi

# Handle debug mode
DEBUG_ARG=""
if [ "$DEBUG_MODE" = "true" ]; then
DEBUG_ARG="--debug"
fi

# Run deploy command
run_hs_command \
"hs project deploy --use-env --json $BUILD_ARG $PROFILE_ARG" \
"hs project deploy --use-env --json $BUILD_ARG $PROFILE_ARG $DEBUG_ARG" \
"true"

# Parse and set outputs
Expand Down
1 change: 1 addition & 0 deletions project-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Uploads and builds a HubSpot project in your account. If auto-deploy is enabled,
- `account_id` (optional): HubSpot account ID associated with the personal access key. If not provided, will use DEFAULT_ACCOUNT_ID from environment.
- `cli_version` (optional): Version of the HubSpot CLI to install. If not provided, will look for `DEFAULT_CLI_VERSION` in environment. If neither are found, defaults to `latest`.
- `profile` (optional): Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment.
- `debug` (optional): Enable debug mode for verbose CLI output. Useful for troubleshooting upload failures. If not provided, will use DEFAULT_DEBUG from environment. Defaults to `false`.

**Outputs:**

Expand Down
13 changes: 12 additions & 1 deletion project-upload/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: "Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment."
required: false
type: string
debug:
description: "Enable debug mode for HubSpot CLI commands. Passes --debug flag to all hs commands. If not provided, will use DEFAULT_DEBUG from environment."
required: false
type: boolean
outputs:
build_id:
description: "The build ID of the created HubSpot project build"
Expand All @@ -40,6 +44,7 @@ runs:
HUBSPOT_PERSONAL_ACCESS_KEY: ${{ inputs.personal_access_key || env.DEFAULT_PERSONAL_ACCESS_KEY }}
HUBSPOT_ACCOUNT_ID: ${{ inputs.account_id || env.DEFAULT_ACCOUNT_ID }}
HUBSPOT_PROFILE: ${{ inputs.profile || env.DEFAULT_PROFILE }}
DEBUG_MODE: ${{ inputs.debug || env.DEFAULT_DEBUG}}
run: |
# Source shared utilities
. "$GITHUB_ACTION_PATH/../scripts/action-utils.sh"
Expand All @@ -56,9 +61,15 @@ runs:
PROFILE_ARG="--profile $HUBSPOT_PROFILE"
fi

# Handle debug mode
DEBUG_ARG=""
if [ "$DEBUG_MODE" = "true" ]; then
DEBUG_ARG="--debug"
fi

# Run upload command
run_hs_command \
"hs project upload --force-create --use-env --json --message '${{ github.event.head_commit.message || 'Uploaded via HubSpot GitHub Action' }} (${GITHUB_SHA:0:7})' $PROFILE_ARG" \
"hs project upload --force-create --use-env --json --message '${{ github.event.head_commit.message || 'Uploaded via HubSpot GitHub Action' }} (${GITHUB_SHA:0:7})' $PROFILE_ARG $DEBUG_ARG" \
"true"

# Parse and set outputs
Expand Down
1 change: 1 addition & 0 deletions project-validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Validates the configuration of a HubSpot project.
- `account_id` (optional): HubSpot account ID associated with the personal access key. If not provided, will use DEFAULT_ACCOUNT_ID from environment.
- `cli_version` (optional): Version of the HubSpot CLI to install. If not provided, will look for `DEFAULT_CLI_VERSION` in environment. If neither are found, defaults to a pre-determined stable version of the CLI.
- `profile` (optional): Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment.
- `debug` (optional): Enable debug mode for verbose CLI output. Useful for troubleshooting validation failures. If not provided, will use DEFAULT_DEBUG from environment. Defaults to `false`.

**Outputs:**

Expand Down
13 changes: 12 additions & 1 deletion project-validate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: "Profile to use for the HubSpot CLI. If not provided, will use DEFAULT_PROFILE from environment."
required: false
type: string
debug:
description: "Enable debug mode for HubSpot CLI commands. Passes --debug flag to all hs commands. If not provided, will use DEFAULT_DEBUG from environment."
required: false
type: boolean
runs:
using: "composite"
steps:
Expand All @@ -35,6 +39,7 @@ runs:
HUBSPOT_PERSONAL_ACCESS_KEY: ${{ inputs.personal_access_key || env.DEFAULT_PERSONAL_ACCESS_KEY }}
HUBSPOT_ACCOUNT_ID: ${{ inputs.account_id || env.DEFAULT_ACCOUNT_ID }}
HUBSPOT_PROFILE: ${{ inputs.profile || env.DEFAULT_PROFILE }}
DEBUG_MODE: ${{ inputs.debug || env.DEFAULT_DEBUG}}
run: |
# Source shared utilities
. "$GITHUB_ACTION_PATH/../scripts/action-utils.sh"
Expand All @@ -51,7 +56,13 @@ runs:
PROFILE_ARG="--profile $HUBSPOT_PROFILE"
fi

# Handle debug mode
DEBUG_ARG=""
if [ "$DEBUG_MODE" = "true" ]; then
DEBUG_ARG="--debug"
fi

# Run validation - command will exit with non-zero if validation fails
run_hs_command "hs project validate --use-env $PROFILE_ARG"
run_hs_command "hs project validate --use-env $PROFILE_ARG $DEBUG_ARG"

echo "✅ Project validation completed successfully"
4 changes: 4 additions & 0 deletions scripts/action-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ run_hs_command() {
COMMAND_OUTPUT=$(eval "$command")
local exit_code=$?

if [ "$DEBUG_MODE" = "true" ]; then
echo "$COMMAND_OUTPUT"
fi

if [ $exit_code -ne 0 ]; then
echo "Error: Command failed with output:"
echo "$COMMAND_OUTPUT"
Expand Down