Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 0 additions & 1 deletion .github/workflows/test-composed-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ env:
DEFAULT_ACCOUNT_ID: ${{ secrets.HUBSPOT_ACCOUNT_ID }}
DEFAULT_PROFILE: "prod"
DEFAULT_CLI_VERSION: "7.9.0"

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
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
5 changes: 5 additions & 0 deletions 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
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
5 changes: 5 additions & 0 deletions 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 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
5 changes: 5 additions & 0 deletions 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 Down
8 changes: 7 additions & 1 deletion scripts/action-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ resolve_project_dir() {
run_hs_command() {
local command="$1"
local expect_json="${2:-false}"
local debug_flag=""

[ "$DEBUG_MODE" = "true" ] && debug_flag="--debug"

# Run command and capture output
COMMAND_OUTPUT=$(eval "$command")
COMMAND_OUTPUT=$(eval "$command $debug_flag")
local exit_code=$?

# Show output if debug mode is enabled
[ -n "$debug_flag" ] && echo "$COMMAND_OUTPUT"

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