🩹 [Patch]: Add path filter to Auto-Release workflow#283
🩹 [Patch]: Add path filter to Auto-Release workflow#283
Conversation
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds path filtering to the Auto-Release workflow to prevent unnecessary releases when only documentation, test data, or metadata files are changed. The workflow will now only trigger when changes affect .github/workflows/** or .github/linters/**, which are the consumable products of this reusable workflow repository.
Changes:
- Added
pathsfilter to Auto-Release workflow limiting triggers to workflow and linter configuration files
| @@ -12,6 +12,9 @@ on: | |||
| - reopened | |||
| - synchronize | |||
| - labeled | |||
There was a problem hiding this comment.
The paths filter does not apply to the labeled event type in GitHub Actions. When a label is added to a PR (e.g., Major, Minor, Patch), the workflow will trigger regardless of which files were changed, because label events don't have associated file changes to filter against.
This means a PR that only changes README.md or test files will still trigger the Auto-Release workflow when labeled, potentially creating an unwanted release.
Consider one of these solutions:
- Remove
labeledfrom the event types if label changes alone should not trigger releases - Add a conditional check in the job using
if:to verify that the PR contains changes to the filtered paths before proceeding with the release - Accept this behavior if the intent is to allow manual release triggers via labels even when only documentation changes
| - labeled |
Auto-Release currently triggers on every PR merge to
main, creating releases for documentation, test data, and metadata changes. This inflates version numbers without delivering value to consumers.Changes
Added
pathsfilter to.github/workflows/Auto-Release.yml:Behavior
Triggers release:
.github/workflows/**(reusable workflows).github/linters/**(workflow-consumed configs)Skips release:
README.md,*.md)tests/**).github/CODEOWNERS,.github/dependabot.yml,.github/instructions/**)Aligns with the pattern used in action repositories (
action.yml,src/**), adapted for a reusable workflow repository where workflows and linter configs are the product.Original prompt
This section details on the original issue you should resolve
<issue_title>Add path filter to Auto-Release workflow to only trigger on significant file changes</issue_title>
<issue_description>### Describe the change
The
Auto-Release.ymlworkflow currently has nopathsfilter, meaning every PR merged tomaintriggers a release — even for changes to documentation, tests, media, or editor configuration. This creates unnecessary releases that provide no value to consumers of the reusable workflows.All action repos (e.g.,
Build-PSModule,GitHub-Script,Publish-PSModule) already use apathsfilter on their Release workflow:The
Process-PSModulerepo should follow the same pattern, but with paths appropriate for a reusable workflow repository rather than an action repository.Problem Statement
Currently, every merged PR triggers a release, even when:
This results in:
Analysis of the repository
The repo has the following structure:
Proposed path filter
Files that SHOULD trigger releases (consumed by workflow callers):
.github/workflows/**— All reusable workflow definitions.github/linters/**— Linter configurations used by the workflowsFiles that SHOULD NOT trigger releases:
tests/**— Test data/reposREADME.md— DocumentationLICENSE— Licensemedia/**— Media assets.gitignore/.gitattributes— Git configuration.vscode/**— Editor settings.github/instructions/**— Copilot instructions.github/CODEOWNERS— GitHub ownership config.github/dependabot.yml— Dependabot configVersion bump behavior
When a release IS triggered, the existing version bump behavior should remain as-is:
Patchlabel or default → Patch version bumpMinorlabel → Minor version bumpMajorlabel → Major version bumpEdge cases
force-release) even when no significant files changed — useful for cases where a rebuild with identical workflow content is neededImplementation
Update
.github/workflows/Auto-Release.ymlto add apathsfilter:This aligns with the pattern used across all action repos, adapted for a reusable workflow repository where
.github/workflows/**and.github/linters/**are the product instead ofaction.ymlandsrc/**.User scenarios
.github/workflows/Build-Module.yml→ Release SHOULD be created.github/linters/.textlintrc→ Release SHOULD be createdREADME.md→ NO release should be createdtests/→ NO release should be createdREADME.mdand.github/workflows/workflow.yml→ Release SHOULD be created (path filter matches at least one file)Supersedes
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.