mirror of
https://github.com/matifali/update-coder-template.git
synced 2025-10-15 01:15:50 +08:00
add dry-run
This commit is contained in:
parent
8be7894259
commit
0b3202d989
3 changed files with 15 additions and 3 deletions
|
@ -25,6 +25,7 @@ Update coder templates automatically
|
|||
| `activate` | Activate the new template version. | `true` |
|
||||
| `create` | Creates a new template if it does not exist | `true` |
|
||||
| `message` | Update message (similar to commit messages) | - |
|
||||
| `dry_run` | Dry run mode. | `false` |
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ inputs:
|
|||
description: "Creates a new template if it does not exist"
|
||||
required: false
|
||||
default: "true"
|
||||
dry_run:
|
||||
description: "Dry run"
|
||||
required: false
|
||||
default: "true" # make it false after testing TODO
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
@ -54,3 +58,4 @@ runs:
|
|||
CODER_TEMPLATE_ACTIVATE: ${{ inputs.activate }}
|
||||
CODER_TEMPLATE_MESSAGE: ${{ inputs.message }}
|
||||
CODER_TEMPLATE_CREATE: ${{ inputs.create }}
|
||||
CODER_TEMPLATE_DRY_RUN: ${{ inputs.dry_run }}
|
||||
|
|
|
@ -38,7 +38,13 @@ fi
|
|||
# Add confirmation flag to the push command
|
||||
push_command+=" --yes"
|
||||
|
||||
# Execute the push command
|
||||
${push_command}
|
||||
|
||||
# Execute the push command if no dry run
|
||||
if [ "${CODER_TEMPLATE_DRY_RUN}" = "false" ]; then
|
||||
echo "Pushing ${CODER_TEMPLATE_DIR} to ${CODER_URL}..."
|
||||
eval ${push_command}
|
||||
echo "A new version of ${CODER_TEMPLATE_DIR} is pushed to ${CODER_URL} successfully."
|
||||
exit 0
|
||||
fi
|
||||
echo "Dry run is enabled. The following command will be executed:"
|
||||
echo ${push_command}
|
||||
echo "A new version of ${CODER_TEMPLATE_DIR} is pushed to ${CODER_URL} successfully."
|
||||
|
|
Loading…
Add table
Reference in a new issue