@@ -127,6 +127,27 @@ runs:
127127 echo "🚀 Setting up GUI-Based Testing Code Review environment..."
128128 mkdir -p artifacts
129129 echo "artifacts-path=artifacts" >> $GITHUB_OUTPUT
130+
131+ # Copy action scripts to workspace if using published action
132+ if [ -d "${{ github.action_path }}/scripts" ]; then
133+ echo "📂 Copying action scripts to workspace..."
134+ mkdir -p .gui-test-review-action/scripts
135+ cp -r "${{ github.action_path }}/scripts"/* .gui-test-review-action/scripts/
136+
137+ # Create a minimal package.json for action dependencies
138+ cat > .gui-test-review-action/package.json << 'EOF'
139+ {
140+ "name": "gui-test-review-action-deps",
141+ "version": "1.0.0",
142+ "private": true,
143+ "dependencies": {
144+ "@octokit/core": "^5.0.0",
145+ "marked": "15.0.12"
146+ }
147+ }
148+ EOF
149+ fi
150+
130151 echo "✅ Environment ready for visual GUI test analysis"
131152
132153 - name : Setup Node.js for GUI test tools
@@ -138,17 +159,31 @@ runs:
138159 shell : bash
139160 run : |
140161 echo "📦 Installing dependencies for GUI test analysis..."
162+
163+ # Install project dependencies if package.json exists
141164 if [ -f "package.json" ]; then
142165 npm install
143166 echo ""
144167 echo "--- Installed Top-Level Dependencies ---"
168+
145169 # List the installed packages. --depth=0 keeps the list clean.
146170 npm list --depth=0
147171 echo "----------------------------------------"
148172 echo "✅ Dependencies installed successfully"
173+
149174 else
150175 echo "⚠️ No package.json found, skipping npm install"
151176 fi
177+
178+ # Install action dependencies if we copied scripts
179+ if [ -d ".gui-test-review-action" ]; then
180+ echo "📦 Installing action dependencies..."
181+ cd .gui-test-review-action
182+ npm install --production
183+ cd ..
184+ fi
185+
186+ echo "✅ Dependencies installed successfully"
152187
153188 - name : Install Playwright browsers for GUI testing
154189 shell : bash
@@ -173,10 +208,19 @@ runs:
173208 REVIEWDOG_REPORTER : ${{ inputs.reviewdog-reporter }}
174209 run : |
175210 echo "🔍 Running code quality analysis for GUI tests..."
176- if [ -f "${{ github.action_path }}/scripts/lint.js" ]; then
177- node "${{ github.action_path }}/scripts/lint.js"
211+
212+ # Determine script location
213+ SCRIPT_PATH=""
214+ if [ -f ".gui-test-review-action/scripts/lint.js" ]; then
215+ SCRIPT_PATH=".gui-test-review-action/scripts/lint.js"
216+ elif [ -f "${{ github.action_path }}/scripts/lint.js" ]; then
217+ SCRIPT_PATH="${{ github.action_path }}/scripts/lint.js"
178218 elif [ -f "scripts/lint.js" ]; then
179- node scripts/lint.js
219+ SCRIPT_PATH="scripts/lint.js"
220+ fi
221+
222+ if [ -n "$SCRIPT_PATH" ]; then
223+ node "$SCRIPT_PATH"
180224 else
181225 echo "⚠️ Lint script not found, skipping code quality analysis"
182226 fi
@@ -191,10 +235,19 @@ runs:
191235 TEST_FILES : ${{ inputs.test-files }}
192236 run : |
193237 echo "🧪 Executing GUI tests on PR branch..."
194- if [ -f "${{ github.action_path }}/scripts/playwright-test.js" ]; then
195- node "${{ github.action_path }}/scripts/playwright-test.js"
238+
239+ # Determine script location
240+ SCRIPT_PATH=""
241+ if [ -f ".gui-test-review-action/scripts/playwright-test.js" ]; then
242+ SCRIPT_PATH=".gui-test-review-action/scripts/playwright-test.js"
243+ elif [ -f "${{ github.action_path }}/scripts/playwright-test.js" ]; then
244+ SCRIPT_PATH="${{ github.action_path }}/scripts/playwright-test.js"
196245 elif [ -f "scripts/playwright-test.js" ]; then
197- node scripts/playwright-test.js
246+ SCRIPT_PATH="scripts/playwright-test.js"
247+ fi
248+
249+ if [ -n "$SCRIPT_PATH" ]; then
250+ node "$SCRIPT_PATH"
198251 else
199252 echo "🎭 Running Playwright tests directly..."
200253 npx playwright test ${{ inputs.test-files }}
@@ -247,10 +300,18 @@ runs:
247300 echo "✅ Main branch test files checked out successfully"
248301 echo "🧪 Running GUI tests on main branch version..."
249302
250- if [ -f "${{ github.action_path }}/scripts/playwright-test.js" ]; then
251- node "${{ github.action_path }}/scripts/playwright-test.js"
303+ # Determine script location
304+ SCRIPT_PATH=""
305+ if [ -f ".gui-test-review-action/scripts/playwright-test.js" ]; then
306+ SCRIPT_PATH=".gui-test-review-action/scripts/playwright-test.js"
307+ elif [ -f "${{ github.action_path }}/scripts/playwright-test.js" ]; then
308+ SCRIPT_PATH="${{ github.action_path }}/scripts/playwright-test.js"
252309 elif [ -f "scripts/playwright-test.js" ]; then
253- node scripts/playwright-test.js
310+ SCRIPT_PATH="scripts/playwright-test.js"
311+ fi
312+
313+ if [ -n "$SCRIPT_PATH" ]; then
314+ node "$SCRIPT_PATH"
254315 else
255316 npx playwright test ${{ inputs.test-files }}
256317 fi
@@ -295,10 +356,19 @@ runs:
295356 shell : bash
296357 run : |
297358 echo "📊 Generating visual flowchart of GUI test execution..."
298- if [ -f "${{ github.action_path }}/scripts/generate-flowchart.js" ]; then
299- node "${{ github.action_path }}/scripts/generate-flowchart.js"
359+
360+ # Determine script location
361+ SCRIPT_PATH=""
362+ if [ -f ".gui-test-review-action/scripts/generate-flowchart.js" ]; then
363+ SCRIPT_PATH=".gui-test-review-action/scripts/generate-flowchart.js"
364+ elif [ -f "${{ github.action_path }}/scripts/generate-flowchart.js" ]; then
365+ SCRIPT_PATH="${{ github.action_path }}/scripts/generate-flowchart.js"
300366 elif [ -f "scripts/generate-flowchart.js" ]; then
301- node scripts/generate-flowchart.js
367+ SCRIPT_PATH="scripts/generate-flowchart.js"
368+ fi
369+
370+ if [ -n "$SCRIPT_PATH" ]; then
371+ node "$SCRIPT_PATH"
302372 else
303373 echo "⚠️ Flowchart script not found, skipping visualization"
304374 fi
@@ -310,10 +380,19 @@ runs:
310380 shell : bash
311381 run : |
312382 echo "📋 Building comprehensive review checklist..."
313- if [ -f "${{ github.action_path }}/scripts/checklist.js" ]; then
314- node "${{ github.action_path }}/scripts/checklist.js"
383+
384+ # Determine script location
385+ SCRIPT_PATH=""
386+ if [ -f ".gui-test-review-action/scripts/checklist.js" ]; then
387+ SCRIPT_PATH=".gui-test-review-action/scripts/checklist.js"
388+ elif [ -f "${{ github.action_path }}/scripts/checklist.js" ]; then
389+ SCRIPT_PATH="${{ github.action_path }}/scripts/checklist.js"
315390 elif [ -f "scripts/checklist.js" ]; then
316- node scripts/checklist.js
391+ SCRIPT_PATH="scripts/checklist.js"
392+ fi
393+
394+ if [ -n "$SCRIPT_PATH" ]; then
395+ node "$SCRIPT_PATH"
317396 else
318397 echo "⚠️ Checklist script not found, skipping checklist generation"
319398 fi
@@ -332,10 +411,21 @@ runs:
332411 shell : bash
333412 run : |
334413 echo "🎨 Building interactive visual dashboard..."
335- if [ -f "${{ github.action_path }}/scripts/generate-webpage.js" ]; then
336- node "${{ github.action_path }}/scripts/generate-webpage.js"
414+
415+ # Determine script location and set NODE_PATH if needed
416+ SCRIPT_PATH=""
417+ NODE_PATH_PREFIX=""
418+ if [ -f ".gui-test-review-action/scripts/generate-webpage.js" ]; then
419+ SCRIPT_PATH=".gui-test-review-action/scripts/generate-webpage.js"
420+ NODE_PATH_PREFIX="NODE_PATH=.gui-test-review-action/node_modules:$NODE_PATH"
421+ elif [ -f "${{ github.action_path }}/scripts/generate-webpage.js" ]; then
422+ SCRIPT_PATH="${{ github.action_path }}/scripts/generate-webpage.js"
337423 elif [ -f "scripts/generate-webpage.js" ]; then
338- node scripts/generate-webpage.js
424+ SCRIPT_PATH="scripts/generate-webpage.js"
425+ fi
426+
427+ if [ -n "$SCRIPT_PATH" ]; then
428+ eval "$NODE_PATH_PREFIX node \"$SCRIPT_PATH\""
339429 else
340430 echo "⚠️ Dashboard script not found, skipping dashboard generation"
341431 fi
@@ -450,10 +540,21 @@ runs:
450540 WEB_REPORT_URL : ${{ inputs.web-report-url || steps.deploy-report.outputs.page_url || format('https://{0}.github.io/{1}/', github.repository_owner, github.event.repository.name) }}
451541 run : |
452542 echo "💬 Posting comprehensive visual feedback to PR..."
453- if [ -f "${{ github.action_path }}/scripts/summary-comment.js" ]; then
454- node "${{ github.action_path }}/scripts/summary-comment.js"
543+
544+ # Determine script location and set NODE_PATH if needed
545+ SCRIPT_PATH=""
546+ NODE_PATH_PREFIX=""
547+ if [ -f ".gui-test-review-action/scripts/summary-comment.js" ]; then
548+ SCRIPT_PATH=".gui-test-review-action/scripts/summary-comment.js"
549+ NODE_PATH_PREFIX="NODE_PATH=.gui-test-review-action/node_modules:$NODE_PATH"
550+ elif [ -f "${{ github.action_path }}/scripts/summary-comment.js" ]; then
551+ SCRIPT_PATH="${{ github.action_path }}/scripts/summary-comment.js"
455552 elif [ -f "scripts/summary-comment.js" ]; then
456- node scripts/summary-comment.js
553+ SCRIPT_PATH="scripts/summary-comment.js"
554+ fi
555+
556+ if [ -n "$SCRIPT_PATH" ]; then
557+ eval "$NODE_PATH_PREFIX node \"$SCRIPT_PATH\""
457558 else
458559 echo "⚠️ Summary comment script not found, skipping PR comment"
459560 fi
@@ -499,4 +600,4 @@ runs:
499600 echo "📈 Summary:"
500601 cat artifacts/test-summary.txt
501602 fi
502- echo "════════════════════════════════════════════════════════"
603+ echo "════════════════════════════════════════════════════════"
0 commit comments