Skip to content

Add CI log grouping for align-deps output#4150

Closed
vivekjm wants to merge 2 commits into
microsoft:mainfrom
vivekjm:add-align-deps-ci-groups
Closed

Add CI log grouping for align-deps output#4150
vivekjm wants to merge 2 commits into
microsoft:mainfrom
vivekjm:add-align-deps-ci-groups

Conversation

@vivekjm
Copy link
Copy Markdown
Contributor

@vivekjm vivekjm commented May 13, 2026

Summary

Adds CI log grouping around align-deps output so runs over larger workspaces are easier to scan in GitHub Actions and Azure DevOps.

This keeps local output unchanged and only opens a group when a package actually writes log output, avoiding empty groups for packages with no changes.

Fixes #2906.

Testing

  • git diff --check
  • yarn workspace @rnx-kit/align-deps format
  • PATH="/Users/vivek/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" yarn workspace @rnx-kit/align-deps lint
  • PATH="/Users/vivek/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" yarn workspace @rnx-kit/align-deps build --dependencies
  • PATH="/Users/vivek/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" yarn workspace @rnx-kit/align-deps test

@vivekjm vivekjm changed the title Group align-deps logs on CI Add CI log grouping for align-deps output May 13, 2026
Copy link
Copy Markdown
Member

@tido64 tido64 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! I've left some comments.

Comment thread packages/align-deps/src/ci.ts Outdated

export function logGroupFor(
title: string,
env: Env = process.env
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Type can be inferred

Suggested change
env: Env = process.env
env = process.env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, thanks. I removed the explicit env type and let TypeScript infer it from the default value.

Comment thread packages/align-deps/src/ci.ts Outdated
): LogGroup | undefined {
if (env["GITHUB_ACTIONS"] === "true") {
return {
start: `::group::${escapeGitHubCommand(title)}`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should use encodeURI instead:

Suggested change
start: `::group::${escapeGitHubCommand(title)}`,
start: `::group::${encodeURI(title)}`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. I switched the GitHub Actions group title handling to use encodeURI here.

Comment thread packages/align-deps/src/cli.ts Outdated
// disk only when everything is in order for the target package. Packages with
// invalid or missing configurations are skipped.
const errors = manifests.reduce((errors, manifest) => {
const logGroup = logGroupFor(manifest);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we always return start/end functions instead?

  const { beginGroup, endGroup } = getGroupMarkers();
  const errors = manifests.reduce((errors, manifest) => {
    try {
      beginGroup(manifest);
      ...
    } finally {
      endGroup(manifest);
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated this to expose beginGroup/endGroup through getGroupMarkers. I also moved the call site behind a small helper so the CLI loop stays readable.

Comment thread packages/align-deps/src/cli.ts Outdated
Comment on lines +272 to +274
if (logGroup) {
console.log(logGroup.start);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is correct. This will always start a group even though we don't know if anything will be logged yet. When no changes are needed, nothing should be logged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I changed the implementation so the group starts lazily on the first log/warn/error for that manifest. If nothing is logged, no group markers are emitted.

@vivekjm vivekjm requested a review from tido64 May 16, 2026 09:21
};
}

export function withLogGroup<T>(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the withLogGroup pattern is a good one. However, I don't think that we should be overwriting global.console like this. I created a draft of what I had in mind here: #4156

If you don't mind, we can close this one in favour of that one. I'll give you full credit for it, of course.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes please !! feel free to close it

@tido64
Copy link
Copy Markdown
Member

tido64 commented May 19, 2026

Superseded by #4156

@tido64 tido64 closed this May 19, 2026
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.

align-deps: add support for grouping log lines on CI

2 participants