refactor: extract Daily Audit Discussion safe-output pattern into shared/daily-audit-discussion.md#21113
Closed
refactor: extract Daily Audit Discussion safe-output pattern into shared/daily-audit-discussion.md#21113
Conversation
#1234) - Add field-level merge support for create-discussion in imports.go - Create shared/daily-audit-discussion.md with base config - Update 42 workflows to import the shared component - Add 3 tests for create-discussion field-level merging - Recompile all 173 workflow lock files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 15, 2026 19:46
View session
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #[issue number]
Summary
Extracts the repeated daily/weekly audit discussion safe-output pattern (present in 42+ workflows) into a new shared component
shared/daily-audit-discussion.md, DRYing up ~130+ lines of duplicated configuration.Changes
Compiler: field-level merging for
create-discussion(pkg/workflow/imports.go)MergeSafeOutputsso that when a workflow definescreate-discussionAND an imported shared component also definescreate-discussion, the imported config is not discarded. Instead a new field-level merge fills in any base fields the workflow left unset.mergeCreateDiscussionsFieldshelper that merges only "base" fields (category,close-older-discussions,required-category,labels,allowed-labels,footer) from the shared component into the main workflow's config. Workflow-specific fields (title-prefix,expires,max,target-repo, etc.) always come from the main workflow.create-discussionproduce an error.Tests (
pkg/workflow/safe_outputs_import_test.go)Three new tests:
TestCreateDiscussionFieldLevelMerge— workflow provides onlytitle-prefix+expires; shared providescategory+close-older-discussions; merged result has all fields.TestCreateDiscussionFieldLevelMergeMainTakesPrecedence— main workflow's explicitcategoryoverrides the shared component'scategory.TestCreateDiscussionImportConflictBetweenSharedComponents— two imported files both definingcreate-discussionstill raises a conflict error.Shared component (
.github/workflows/shared/daily-audit-discussion.md)Intentionally excludes
upload-asset:to avoid conflicts withshared/python-dataviz.mdwhich also provides it.42 workflows updated
Each updated workflow:
shared/daily-audit-discussion.mdas the first importcategory: "audits",max: 1,close-older-discussions: truelines fromcreate-discussionclose-discussion: max: 10blocks (5 workflows that already had this explicitly)title-prefix,expirescreate-discussionhad only base fields (no title-prefix, no expires) have the block removed entirely — the shared component provides it allpoem-bot.mdis intentionally not updated (usesstaged: true,max: 2, and custom labels).Security Summary
CodeQL scan found no alerts. No new dependencies added.