Skip to content

Conversation

@mrVanDalo
Copy link

@mrVanDalo mrVanDalo commented Dec 12, 2025

Closes #222

Mostly Vibe coded using claude

This would be the contents of $GITHUB_STEP_SUMMARY when running ./result/bin/nix-fast-build --github-summary in this repository

| Target | Result |
| --- | --- |
| x86_64-linux.package-nix-fast-build | ✅ |
| x86_64-linux.treefmt | ✅ |

@mrVanDalo mrVanDalo force-pushed the feature/github-summary branch from 7621fbb to 74b278d Compare December 12, 2025 23:16

def test_github_summary_without_env() -> None:
env = {k: v for k, v in os.environ.items() if k != "GITHUB_STEP_SUMMARY"}
with patch.dict(os.environ, env, clear=True):
Copy link
Owner

Choose a reason for hiding this comment

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

There is a pytest fixture in "monkeypatch" that does that.

await asyncio.to_thread(write_result_file)

if opts.github_summary:
github_summary_path_str = os.environ.get("GITHUB_STEP_SUMMARY")
Copy link
Owner

Choose a reason for hiding this comment

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

Don't think we need a flag, we can just test for the presents for GITHUB_STEP_SUMMARY.

results, # type: ignore[arg-type]
)

await asyncio.to_thread(write_result_file)
Copy link
Owner

Choose a reason for hiding this comment

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

Don't get why this was moved to a thread.

Copy link
Author

Choose a reason for hiding this comment

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

claude fixed that. Because of some linting problems. I don't really know.

nonlocal rc
rc = 1

await asyncio.to_thread(write_github_summary)
Copy link
Owner

Choose a reason for hiding this comment

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

Same here. Also this is blocking io, it happens after we are done with everything. So we are blocking anyway.

def test_github_summary_with_env() -> None:
with TemporaryDirectory() as d:
path = Path(d) / "summary.md"
with patch.dict(os.environ, {"GITHUB_STEP_SUMMARY": str(path)}):
Copy link
Owner

Choose a reason for hiding this comment

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

Same here. We also only need this test and not the negative one, because we can just unset the environment variable in one of the existing tests.

Copy link
Author

@mrVanDalo mrVanDalo Dec 13, 2025

Choose a reason for hiding this comment

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

So we should default to GITHUB_STEP_SUMMARY present? and add a parameter to overwrite this environment variable, and look for this environment variable instead if present, and than write output to this file?

e.g.: --step-summary-variable FORGEJO_STEP_SUMMARY will check if FORGEJO_STEP_SUMMARY is set and a path to a file , ... ?

Copy link
Owner

Choose a reason for hiding this comment

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

Mhm. To make it simpler for the user, can we not also detect gitea/forgeo as well?
If we really need to make this configurable we can do something like --ci-summary auto|off.

@Mic92
Copy link
Owner

Mic92 commented Dec 13, 2025

Added in #239

@Mic92 Mic92 closed this Dec 13, 2025
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.

Support Github_Summary

2 participants