Skip to content

feat: add GitHub Actions step summary for workflow runs#342

Merged
zkoppert merged 8 commits intomainfrom
jm_workflow_output_for_summary
Mar 3, 2026
Merged

feat: add GitHub Actions step summary for workflow runs#342
zkoppert merged 8 commits intomainfrom
jm_workflow_output_for_summary

Conversation

@jmeridth
Copy link
Collaborator

@jmeridth jmeridth commented Mar 1, 2026

Pull Request

Proposed Changes

What

Write run statistics as markdown to $GITHUB_STEP_SUMMARY so results appear on the workflow run summary page in the GitHub UI. The summary includes overall stats, repositories with users to remove, repositories missing CODEOWNERS files, and pull request links for any pull requests generated. It runs unconditionally when the environment variable is present and silently no-ops otherwise. On error, the summary still writes with partial stats and an error section, then exits with code 1.

Why

Previously the only way to see run results was to dig into the job logs. Surfacing the report on the summary page gives immediate visibility without expanding log output.

Notes

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing

### What

Write run statistics as markdown to $GITHUB_STEP_SUMMARY so results
appear on the workflow run summary page in the GitHub UI. The summary
includes overall stats, repositories with users to remove, and
repositories missing CODEOWNERS files. It runs unconditionally when
the environment variable is present and silently no-ops otherwise.
On error, the summary still writes with partial stats and an error
section, then exits with code 1.

### Why

Previously the only way to see run results was to dig into the job
logs. Surfacing the report on the summary page gives immediate
visibility without expanding log output.

### Notes

- The summary file is opened in append mode ("a") per GitHub's
  convention, so other steps can also contribute to the summary
- Unlike the existing write_to_markdown (gated by ISSUE_REPORT),
  write_step_summary always runs — no configuration needed
- The main loop is wrapped in try/except/finally so the summary
  always writes, even on failure. Partial stats are preserved and
  the error message is surfaced in a dedicated section
- Success example with PR link(s): https://gist.github.com/jmeridth/0fbb8bb34882e437afdde0b81944b80f
- Success example with no changes needed: https://gist.github.com/jmeridth/deef8adb4dca29dd9e7ebe25e0db73fa
- Error example: https://gist.github.com/jmeridth/6918e8dbcada95683da31d653c6b0e8b

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth self-assigned this Mar 1, 2026
@jmeridth jmeridth requested a review from zkoppert as a code owner March 1, 2026 08:54
@jmeridth
Copy link
Collaborator Author

jmeridth commented Mar 1, 2026

@zkoppert i woke up realizing we may want some emojis in the summary. 🤔

codeowners_count,
repo_and_users_to_remove,
repos_missing_codeowners,
write_step_summary(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should writing the step summary be able to be disabled if someone doesn't want it? Maybe we just wait to see what users say?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done c136878

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, lets see what users say

jmeridth and others added 4 commits March 1, 2026 15:18
### What

Add a section to the README describing the automatic step summary
that appears on the workflow run summary page.

### Why

Users should know this feature exists without reading the source code.
The summary requires no configuration but its existence isn't
discoverable from the current documentation.

### Notes

- Placed before "Example workflows" since it describes built-in
  behavior rather than a configuration option

Signed-off-by: Jason Meridth <jmeridth@gmail.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
… var

### What

Add an ENABLE_GITHUB_ACTIONS_STEP_SUMMARY boolean environment variable
that controls whether the workflow run summary is written. The default
is true, so the step summary is enabled out of the box.

### Why

Making the feature controllable via an environment variable is
consistent with how other optional behaviors (DRY_RUN, ISSUE_REPORT)
are configured in this action. Defaulting to true ensures users get
the summary without extra configuration while still allowing opt-out.

### Notes

- Existing users will see summaries immediately after upgrading
  since the default is true; set to false to opt out
- The boolean check happens before the GITHUB_STEP_SUMMARY file
  path check, so the function returns early without touching the
  filesystem when disabled
- Table column widths in the README were adjusted to accommodate
  the longer env var name and pass markdownlint MD060

Signed-off-by: Jason Meridth <jmeridth@gmail.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
## What

Extract duplicated repos/users-to-remove and repos-missing-codeowners
sections from write_to_markdown and write_step_summary into shared
helper functions _write_repos_and_users_to_remove and
_write_repos_missing_codeowners.

## Why

Prevents the two output functions from diverging over time as changes
are made to the shared sections independently.

## Notes

- Stats sections intentionally remain separate since their formatting
  differs significantly between the report file and step summary.
- Helpers are prefixed with underscore to indicate internal use.

Signed-off-by: Jason Meridth <jmeridth@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
## What

Print "GITHUB_STEP_SUMMARY not set, skipping step summary" instead of
silently returning when the runner environment variable is absent.

## Why

When a user enables the step summary feature but runs outside GitHub
Actions, this message explains why no summary was written.

## Notes

- Addresses PR review feedback from @zkoppert on #342.

Signed-off-by: Jason Meridth <jmeridth@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth requested a review from zkoppert March 1, 2026 22:29
jmeridth and others added 3 commits March 1, 2026 16:39
Signed-off-by: jmeridth <jmeridth@gmail.com>
## What

Add contextual emojis to step summary section headers to provide
visual status indicators at a glance.

## Why

Makes the GitHub Actions step summary easier to scan by surfacing the
overall health of the run through visual cues in the section titles.

## Notes

- ✅ on Overall Stats when no users to remove AND no
  missing CODEOWNERS files; ⚠️ otherwise.
- ⚠️ on Repositories and Users to Remove / Missing CODEOWNERS
  only when there is no error (avoids double signaling with ❌).
- 🔗 always on Pull Requests Created.
- ❌ always on Error.
- Emojis only affect step summary output, not the report.md file used
  for issue creation.
- Helper functions accept an optional header_suffix so write_to_markdown
  continues to produce emoji-free output.

Signed-off-by: Jason Meridth <jmeridth@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
Signed-off-by: jmeridth <jmeridth@gmail.com>
Copy link
Collaborator

@zkoppert zkoppert left a comment

Choose a reason for hiding this comment

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

🚀

@zkoppert zkoppert merged commit e39900d into main Mar 3, 2026
33 checks passed
@zkoppert zkoppert deleted the jm_workflow_output_for_summary branch March 3, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants