Skip to content

GitHub Action ​

The TraceLens Action checks a JSON event export against tracelens.yml, publishes the same stable JSON report as a workflow artifact, adds a Markdown job summary, creates a GitHub Check, and creates or updates one pull-request comment.

The Action ships with the v1.0.0 repository release. Version tags are convenient for examples; pin a full commit SHA when your security policy requires an immutable action reference.

Workflow ​

Your preceding steps must produce a JSON array of TraceLens events. Copy the complete workflow, or add this step to an existing workflow:

yaml
permissions:
  contents: read
  checks: write
  pull-requests: write

steps:
  - uses: actions/checkout@v7

  - name: Check TraceLens performance budgets
    uses: leracherry/tracelens@v1.0.0
    with:
      trace-file: artifacts/tracelens-events.json
      config-file: tracelens.yml
      github-token: ${{ secrets.GITHUB_TOKEN }}
      app: billing-dashboard
      environment: production

The action fails when any threshold is exceeded or a check has fewer than minimumSamples. Set fail-on-budget: false to run in reporting-only mode while establishing a baseline; failed budget checks then use a neutral GitHub Check conclusion.

The default comment: auto posts only for pull-request events. TraceLens searches for its hidden marker and updates the existing bot comment on later runs instead of adding another comment. Use comment: never to disable this behavior, or comment: always to request a comment and receive a warning on non-PR events.

Inputs ​

InputRequiredDefaultDescription
trace-fileYes—TraceLens JSON event array.
config-fileNotracelens.ymlPerformance-budget YAML.
releaseNoNewest in traceRelease selector.
appNoInferredApplication selector. Required for mixed-app traces.
environmentNoInferredEnvironment selector. Required for mixed-environment traces.
github-tokenNo—Token for check runs and PR comments.
create-checkNotrueCreate a completed GitHub Check when a token exists.
commentNoautoauto, always, or never.
upload-artifactNotrueUpload the JSON report for 14 days.
artifact-nameNotracelens-performance-reportArtifact name.
report-fileNotracelens-budget-report.jsonWorkspace-relative JSON output path.
fail-on-budgetNotrueFail the action for failed or no-data checks.

Outputs ​

  • passed: true only when every configured check passes.
  • report-file: absolute path to the generated JSON report.
  • summary: concise pass/fail/no-data counts.

The JSON report is written before GitHub API calls and remains available to later steps with if: always(). The report path must stay within GITHUB_WORKSPACE; this prevents an accidental output setting from overwriting files elsewhere on the runner.

Permissions and fork pull requests ​

contents: read is sufficient for the local budget evaluation, job summary, and workflow artifact. checks: write enables the dedicated check run, and pull-requests: write enables the PR comment. If no token is supplied, the action skips both GitHub API features but still evaluates budgets.

GitHub normally gives workflows from forked pull requests a read-only token. TraceLens treats check/comment permission errors as warnings so the budget result and artifact are still produced. Do not use pull_request_target to run untrusted contribution code with a write token.

Reports ​

The job summary, check, PR comment, and JSON artifact all describe the same evaluation. The Markdown surfaces show metric, scope, actual value, threshold, and sample count. A missing sample is displayed as No data and fails closed.

See performance budgets for configuration, metric semantics, and CLI usage.

Released under the MIT License.