Skip to content

Commit

Permalink
Merge pull request #18 from equinix-labs/noexec_custom_script
Browse files Browse the repository at this point in the history
fix: avoid execution of custom_script during evaluation
  • Loading branch information
displague authored Oct 2, 2024
2 parents f29a6cd + 92a6bca commit 5de4ce8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ runs:
--labels ${{ steps.get-registration.outputs.runner_scope }} --ephemeral
# Running custom script if provided
if [[ -n "${{ inputs.custom_script }}" ]]; then
CUSTOM_SCRIPT=$(mktemp $HOME/custom_script.XXXXXX.sh)
cat > $CUSTOM_SCRIPT <<'CUSTOM_SCRIPT_EOF'
${{ inputs.custom_script }}
CUSTOM_SCRIPT_EOF
chmod 0700 $CUSTOM_SCRIPT
echo "Running custom user script"
$CUSTOM_SCRIPT
CUSTOM_SCRIPT=$(mktemp $HOME/custom_script.XXXXXX.sh)
cat > $CUSTOM_SCRIPT <<'CUSTOM_SCRIPT_EOF'
${{ inputs.custom_script }}
CUSTOM_SCRIPT_EOF
if [[ -s $CUSTOM_SCRIPT ]]; then
chmod 0700 $CUSTOM_SCRIPT
echo "Running custom user script"
$CUSTOM_SCRIPT
else
rm $CUSTOM_SCRIPT
fi
# Install and start the runner service
Expand Down

0 comments on commit 5de4ce8

Please sign in to comment.