Skip to content

fix: send @actions workflow commands to the CLI log, not to stdout - #46

Open
xSAVIKx wants to merge 1 commit into
mainfrom
fix/cli-workflow-commands
Open

xSAVIKx wants to merge 1 commit into
mainfrom
fix/cli-workflow-commands

Conversation

@xSAVIKx

@xSAVIKx xSAVIKx commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Problem

Outside GitHub Actions, the cloud-cache CLI printed raw workflow commands to stdout. @actions/core, @actions/cache and @actions/glob write lines such as ::debug::..., ::warning::... and ::group::.... Only GitHub Actions reads them. In a Bitbucket or generic log they are noise, a warning does not go to stderr, and an ::add-mask:: line would print the secret value.

Measured before the fix: cloud-cache restore --dual-cache and cloud-cache save --dual-cache against a local RustFS printed about 40 ::debug:: and ::warning:: lines on stdout.

Change

  • New src/cli/workflowCommands.ts. It intercepts process.stdout.write while the CLI runs a command, after the host is set. Each workflow command line goes to the host log:
    • debug goes to log.debug, which prints only with --debug.
    • warning goes to log.warning, and error goes to log.error. Both print on stderr.
    • notice goes to log.info.
    • group and endgroup go to log.startGroup and log.endGroup.
    • add-mask is dropped.
    • Other text, unknown commands and Buffer writes pass through unchanged. The escaped characters %0A, %0D and %25 are decoded.
  • The narrow interceptor around hashFiles in hashTemplate.ts is removed, because the new one covers it. This also fixes a known small defect: the old interceptor dropped plain text that came in the same write as a ::debug:: line.

Measured

  • Unit tests: tests/unit/cli/workflowCommands.test.ts has 6 new tests. They use the real @actions/core functions.
  • npm test: 1304 passed, 16 skipped.
  • npm run lint, npm run format:check and npm run typecheck pass.
  • CLI integration tests against local RustFS (TEST_CLI=1): 10 passed.
  • The same reproduction after the fix: 0 lines that start with :: on stdout. The warnings print on stderr as warning: ....

Not measured

  • I did not run the CLI on Windows or macOS.
  • I did not run it on a real Bitbucket pipeline.

This branch has not been deployed

No deployments
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