feat: v2 — TypeScript rewrite with Flashlight, suites, PR comment, artifacts#1
Merged
Conversation
- TypeScript 5.x with strict mode + ncc bundling to dist/index.js - Jest with ts-jest for unit tests - ESLint (@typescript-eslint) with plugin:recommended - Node 20 runtime kept from v1 - Removes legacy github-action.js (replaced by TS sources) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- inputs.ts: parseInputs() with defaults for all 9 v2 inputs - reporter/parse-results.ts: aggregates the multi-suite payload from php-library into a unified TestReport (passed/failed/skipped/todos/ total/durationMs/failures with source location) - reporter/outputs.ts: setOutputs() writes all GH Action outputs - Fixtures for success, failure, multi-suite, and legacy shapes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- buildCommentBody(): success (short form) and failure (table + <details>) markdown bodies, prefixed with an HTML marker for update-in-place - postOrUpdatePrComment(): lists PR comments, updates the marker-matched one or creates a new one; failures logged as warnings, never throws Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- runComposer(): runs `composer run prestaflow:json:file` when composer.json is present; skips otherwise - suitesEnv(): CSV list -> PRESTAFLOW_SUITES env var for the PHP lib Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- upload/api.ts: multipart POST to https://api.prestaflow.io/ci/github-action/ (v1 endpoint/payload preserved for backward compatibility); returns {id, url} - upload/artifacts.ts: uploads results.json + error screenshots as prestaflow-report-<runId>-<attempt> via @actions/artifact v2 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- mount.ts: resolves container mount target from composer.json type (prestashop-module/theme) with sensible fallbacks - compose-template.ts: renders docker-compose.yml (image, port, volume, env) - docker.ts: pickPort() with 8000-8002 fallback, assertDockerAvailable(), startFlashlight() with readiness poll and teardown handle (logs on failure via core.startGroup) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- main.ts: full v2 flow (inputs -> optional flashlight -> composer -> parse -> upload API/artifacts -> setOutputs -> optional PR comment -> setFailed on regressions, with finally teardown of the flashlight container). Outputs set before setFailed so `if: always()` steps can consume them. - action.yml: publishes 9 inputs and 8 outputs for v2 - README.md: quick start + Flashlight example + docs pointer - .github/workflows/ci.yml: PR/main lint + test + build + dist freshness check Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full v2 rewrite of the action in TypeScript. Keeps v1 usage (
token+projectIdonly) working unchanged, adds:flashlight: true+ps-version:): auto-provisions a PrestaShop Docker instance for tests to target. Detects the consuming repo type fromcomposer.jsonand mounts it undermodules/orthemes/. Port fallback 8000→8001→8002. Container is always torn down (logs captured on failure).suites: BackOffice,FrontOffice): forwarded to the PHP library viaPRESTAFLOW_SUITESenv var. Requires the matching change already merged inphp-library#50.pr-comment: true, default onpull_requestevents): posts a summary comment with totals table + first 10 failing tests (source location + error). Updates the same comment in place across pushes via an HTML marker. Requirespermissions: pull-requests: writeon the calling workflow.upload-artifacts: trueby default): uploadsresults.json+ error screenshots asprestaflow-report-<run-id>-<attempt>.id,report-url,passed,failed,skipped,total,duration-ms,status. All set before anysetFailed(), soif: always()downstream steps can consume them.Architecture
@vercel/ncc-bundleddist/index.jscommitted.inputs,flashlight/{mount,compose-template,docker},runner/{composer,suites},upload/{api,artifacts},reporter/{parse-results,outputs,pr-comment-body,pr-comment}. Single orchestrator insrc/main.ts.php-library#50({ "suites": [...] }with per-test source location). Legacy single-suite payload also parsed for backward compat.Backward compatibility
v1 workflows (only
token+projectId) continue to work: same endpoint, same payload, sameidoutput.Test plan
npm run lint— cleannpm test— 12 suites, 41 tests, all passingnpm run build— dist rebuilt (6.4 MB).github/workflows/ci.ymlfails when dist/ is stalePrestaFlow/prestaflow-prestashop) after merge and before taggingv2.0.0Docs
Full docs updated in a separate PR on
PrestaFlow/prestaflow.io.Follow-ups
v2.0.0+ movingv2tag once this is merged and smoke-tested.🤖 Generated with Claude Code