Skip to content

feat: parse deploy errors into PR report - #4

Merged
0ptaq0 merged 3 commits into
mainfrom
feat/deploy-error-report
Sep 20, 2026
Merged

0ptaq0 merged 3 commits into
mainfrom
feat/deploy-error-report

Conversation

@0ptaq0

@0ptaq0 0ptaq0 commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Why

When sf project deploy start failed, the tests step was skipped and the PR comment still said "All Tests Passed / No test results found" (see beyond-the-cloud-dev/trigger-lib#7). The actual component errors were only visible deep in the job log.

What

  • Deploy runs with --json and continue-on-error, output saved to tests/apex/deploy-result.json.
  • New scripts/deploy-report.js parses it: component failures grouped per component and problem, "Dependent class is invalid" cascades collapsed under the root error, hints matched from scripts/deploy-tips.js, ::error file=...,line=... annotations on the failing files, job summary, and step outputs (status, error_count, ...).
  • New scripts/pr-comment.js builds the single 🚀 Salesforce CI PR comment (deployment status first, then test summary). Replaces the inline JS that was duplicated in both workflows. It still updates the old 🧪 Apex Test Results comment if one exists.
  • Tests, coverage and Codecov steps run only when the deploy succeeded. The job fails explicitly when the deploy or tests failed.
  • Scripts are checked out from this repo at the new template-ref input (default main). github.job_workflow_sha is empty in reusable workflows, so an input is the only way to test a template branch end to end.
  • Same changes in salesforce-ci.yml and salesforce-ci-with-build.yml. README documents the scripts and the input.

Tested on

  • ci: test deploy error report (throwaway) trigger-lib#8: deploy failure with 33 identical errors in one class, one row plus hint, annotation on line 662, tests skipped, job red.
  • ci: test deploy error report (throwaway) cache-manager#12: success path, 21 tests, Codecov upload, job green.
  • beyond-the-cloud-dev/apexfluently#17: with-build variant, 16 errors, comment and job status correct. That run used the script version before the cascade collapsing; the collapsed rendering (root cause QueueableBuilder alone, 15 dependents folded) was verified locally against that run's deploy-result.json. A live rerun could not start because the org hit its Actions spending limit for private repos.

Those three PRs are throwaway and are closed. Every repo uses @main, so merging this rolls it out everywhere; no change needed in the callers.

A failed deploy used to skip the tests and the PR comment then said
"All Tests Passed / No test results found". Deploy now runs with
--json, scripts/deploy-report.js turns component failures into a
Markdown table with hints and file annotations, and the PR comment
shows deployment status before test results. Scripts are checked out
from this repo at github.job_workflow_sha so template branches can be
tested from any project.
github.job_workflow_sha is empty inside a reusable workflow, so the scripts checkout fell back to main.
Show the root compile error as the only table row and list the classes that fail just because they depend on it in a collapsed section. Adds a hint for global methods with non-global types.
@0ptaq0
0ptaq0 merged commit 99b7735 into main Sep 20, 2026
2 checks passed
@0ptaq0
0ptaq0 deleted the feat/deploy-error-report branch September 20, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant