diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b1d33f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM quali/torque-cli:2.5.8 + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/action.yaml b/action.yaml index e56b3e8..c6914e6 100755 --- a/action.yaml +++ b/action.yaml @@ -18,17 +18,16 @@ inputs: runs: using: "docker" - image: "docker://qtorque/torque-cli:1.7" + image: "Dockerfile" args: - - env - - end - ${{ inputs.environment_id }} + - ${{ inputs.space }} env: TORQUE_TOKEN: ${{ inputs.torque_token }} TORQUE_SPACE: ${{ inputs.space }} TORQUE_HOSTNAME: ${{ inputs.torque_hostname }} - TORQUE_USERAGENT: Torque-Plugin-Github-Env-Environment-Action/v1 + TORQUE_USERAGENT: Torque-Plugin-Github-Start-Environment-Action/v1 branding: icon: 'stop-circle' diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..16bee79 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh -l + +ENV_ID="$1" +SPACE="$2" + +echo "Ending environment with id '${ENV_ID}' in space '${SPACE}'" +params="\"${ENV_ID}\" --space \"${SPACE}\"" + +command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN" +echo "The following command will be executed: ${command}" + +echo "Ending environment..." +response=$(eval $command 2>&1) +exit_code=$? +if [ $exit_code -ne 0 ]; then + echo "Error: Failed to end environment" + echo "$response" + exit $exit_code +fi + +echo "Environment ended successfully." + +echo "Writing data to outputs" +echo "environment_id=${ENV_ID}" >> $GITHUB_OUTPUT +