Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM quali/torque-cli:2.5.8

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
7 changes: 3 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
25 changes: 25 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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"
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI path '/Quali.Torque.Cli/torque-cli' appears incorrect. Based on the Dockerfile using 'quali/torque-cli:2.5.8' base image, the CLI should be available in the system PATH as 'torque-cli' without the full path prefix. Verify the correct path or use just 'torque-cli'.

Suggested change
command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN"
command="torque-cli env end ${params} --token $TORQUE_TOKEN"

Copilot uses AI. Check for mistakes.
echo "The following command will be executed: ${command}"

echo "Ending environment..."
response=$(eval $command 2>&1)
Comment on lines +7 to +13
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using string concatenation and eval for command execution is a security risk and makes the code fragile. The shell can properly handle arguments without eval. Replace lines 7-13 with direct command execution: response=$(/Quali.Torque.Cli/torque-cli env end \"${ENV_ID}\" --space \"${SPACE}\" --token \"$TORQUE_TOKEN\" 2>&1) to avoid eval and properly quote the token.

Suggested change
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)
echo "The following command will be executed: /Quali.Torque.Cli/torque-cli env end \"${ENV_ID}\" --space \"${SPACE}\" --token \"***\""
echo "Ending environment..."
response=$(/Quali.Torque.Cli/torque-cli env end "${ENV_ID}" --space "${SPACE}" --token "$TORQUE_TOKEN" 2>&1)

Copilot uses AI. Check for mistakes.
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