Skip to content

Conversation

@ncalteen
Copy link
Collaborator

@ncalteen ncalteen commented Apr 17, 2025

This PR adds some additional logging at the end of the local action run. If any outputs were created via the setOutput method of @actions/core, they will be logged in a table following the completion of the run.

================================================================================
                                 Action Outputs
================================================================================

┌─────────┬────────────┬─────────────────────────────────────────────┐
│ (index) │   Output   │                    Value                    │
├─────────┼────────────┼─────────────────────────────────────────────┤
│    0    │   'time'   │ '15:14:47 GMT-0400 (Eastern Daylight Time)' │
│    1    │ 'someJSON' │           '{"msg":"hello world"}'           │
└─────────┴────────────┴─────────────────────────────────────────────┘

If no outputs were set, a relevant message will appear.

================================================================================
                                 Action Outputs
================================================================================

No outputs were set!

The output logic attempts to stringify any value passed to the setOutput function.

@ncalteen ncalteen self-assigned this Apr 17, 2025
Copilot AI review requested due to automatic review settings April 17, 2025 19:17
@github-actions
Copy link

Semantic Version Check Passed ✅

Version in manifest file package.json is valid.

This comment will be automatically updated as changes are pushed to this PR branch.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds enhanced logging at the end of a local action run by outputting any set action outputs in a formatted table, or displaying a message if none were set.

  • Updates the setOutput function to convert non-string values and skip outputs containing secrets.
  • Adds a table-based log output for action outputs in the action runner.
  • Extends tests to verify conversion behavior and secret filtering for outputs.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/stubs/core/core.ts Updates setOutput to handle various value types and secret filtering.
src/commands/run.ts Adds logic to display action outputs as a formatted table in the console.
tests/stubs/core/core.test.ts Adds tests verifying output conversion and secret filtering in setOutput.
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/commands/run.ts:392

  • [nitpick] The variable name 'i' is ambiguous; consider renaming it to 'outputName' for improved clarity.
Object.keys(CoreMeta.outputs).map(i => ({

@github-actions
Copy link

github-actions bot commented Apr 17, 2025

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 5 0 0 0.15s
✅ JAVASCRIPT prettier 11 0 0 1.57s
✅ JSON npm-package-json-lint yes no no 0.94s
✅ JSON prettier 29 0 0 2.88s
✅ MARKDOWN markdownlint 9 0 0 1.27s
✅ REPOSITORY checkov yes no no 27.96s
✅ REPOSITORY gitleaks yes no no 1.34s
✅ REPOSITORY git_diff yes no no 0.01s
✅ REPOSITORY grype yes no no 46.79s
✅ REPOSITORY secretlint yes no no 1.08s
✅ REPOSITORY syft yes no no 10.21s
❌ REPOSITORY trivy yes 1 no 16.95s
✅ REPOSITORY trivy-sbom yes no no 1.37s
✅ REPOSITORY trufflehog yes no no 33.04s
✅ TYPESCRIPT prettier 82 0 0 3.03s
✅ YAML prettier 24 0 0 1.04s
✅ YAML yamllint 24 0 0 0.45s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen requested a review from Copilot April 17, 2025 19:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds enhanced logging at the end of the action run to display any outputs set via setOutput, formatting them into a table when present and showing a default message otherwise.

  • Updated setOutput in core.ts to handle values of various types and to convert non-string values.
  • Updated run.ts to log outputs using console.table when outputs exist.
  • Expanded tests in core.test.ts to cover multiple output types and validate secret filtering behavior.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/stubs/core/core.ts Modified setOutput to convert non-string values and skip outputs containing secrets.
src/commands/run.ts Added console logging to display action outputs in a table format.
tests/stubs/core/core.test.ts Added tests to cover various output types and verify secret output behavior.
Files not reviewed (1)
  • package.json: Language not supported

@ncalteen ncalteen merged commit 5bfe150 into main Apr 17, 2025
13 of 14 checks passed
@ncalteen ncalteen deleted the ncalteen/outputs branch April 17, 2025 19:31
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.

4 participants