Skip to content

Commit c1874fa

Browse files
committed
moved ext_script.js to temp folder to avoid collision with user code
1 parent df866ea commit c1874fa

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,15 @@ runs:
5959
- name: Write script to file
6060
shell: bash
6161
run: |
62+
# Ensure the temp directory exists (usually does, but just in case)
63+
mkdir -p "${RUNNER_TEMP}"
64+
6265
# WARNING: Must use single-quoted HEREDOC (<<'EOF') to write the script
6366
# exactly as provided. This preserves characters like $, ${},
6467
# backticks, and multiline formatting without shell or YAML
6568
# interpolation — ensuring the JavaScript is written to the file
6669
# verbatim.
67-
cat <<'EOF' > ext_script.js
70+
cat <<'EOF' > "${RUNNER_TEMP}/ext_script.js"
6871
${{ inputs.script }}
6972
EOF
7073
@@ -96,8 +99,10 @@ runs:
9699
97100
console.info("Received Input Label:", "${{ inputs.label }}");
98101
console.info("Received Input post-target:", postTarget);
99-
console.info("Reading ext_script.js...");
100-
const scriptContent = fs.readFileSync('ext_script.js', 'utf8');
102+
const path = require('path');
103+
const scriptPath = path.join(process.env.RUNNER_TEMP, 'ext_script.js');
104+
console.info(`📄 Reading script from ${scriptPath}`);
105+
const scriptContent = fs.readFileSync(scriptPath, 'utf8');
101106
102107
// Dynamically execute the input script provided in GitHub Action
103108
console.info('🚀 Executing user script...');

0 commit comments

Comments
 (0)