Skip to content

Make release-triggering file patterns configurable via settings file #278

@MariusStorhaug

Description

Context

The Process-PSModule workflow determines whether to run build, test, and publish stages based on which files changed in a pull request. Only changes to "important" files — those matching specific regex patterns — trigger these stages. This mechanism prevents unnecessary PowerShell Gallery publishes when only non-module files (workflows, linter configs, tests) are modified.

Request

The list of important file patterns is currently hardcoded in Get-PSModuleSettings/src/main.ps1 as:

$importantPatterns = @(
    '^src/'
    '^README\.md$'
)

There is no way to override or extend this list without modifying the action source code. Repositories that need additional paths to trigger releases — such as examples/, configuration files, or custom documentation directories — cannot configure this behavior.

Desired experience

The important file patterns should be configurable through the standard settings file (.github/PSModule.yml), following the same convention used for every other module-level setting (labels, skip flags, coverage targets). The default patterns should remain ^src/ and ^README\.md$ for backward compatibility, but repositories should be able to override them.

Example configuration in .github/PSModule.yml:

ImportantFilePatterns:
  - '^src/'
  - '^README\.md$'
  - '^examples/'

Acceptance criteria

  • The settings file accepts an ImportantFilePatterns property as an array of regex patterns
  • The default patterns (^src/, ^README\.md$) are used when no override is configured
  • User-configured patterns fully replace the defaults (not merge) for predictable behavior
  • The PR comment that explains skipped stages dynamically reflects the configured patterns instead of being hardcoded
  • The settings schema is updated to validate the new property
  • Documentation reflects the new setting and its defaults

Technical decisions

Setting location: Top-level ImportantFilePatterns property in the settings file schema. This setting affects build, test, publish, and site deployment decisions — it is cross-cutting and does not belong under any single section (Build, Test, or Publish). Placing it at the top level is consistent with Name, which is also a top-level cross-cutting property.

Action input: Add a corresponding ImportantFilePatterns input to the Get-PSModuleSettings action.yml with a newline-separated default value. This makes the defaults visible and discoverable in the action definition, and allows workflow-level overrides without a settings file. Newline-separated format is used because regex patterns may contain commas.

Resolution order: Settings file → action input → hardcoded fallback in code. This follows the existing precedent where the settings file takes priority over action inputs (e.g., Name).

Override semantics: Full replacement, not merge. When a repository sets ImportantFilePatterns, the entire default list is replaced. This avoids complex merge logic and gives clear, predictable control. If a user wants to add to the defaults, they include the defaults in their override list.

PR comment update: The hardcoded markdown table in the PR comment that lists important paths must be generated dynamically from the resolved patterns. This ensures the comment always matches the actual patterns in effect.

Input cascade: The new input must be passed through the Get-Settings.yml reusable workflow and the workflow.yml entry point, following the existing pattern for other inputs.

Affected repositories:


Implementation plan

Get-PSModuleSettings action

  • Add ImportantFilePatterns input to action.yml with newline-separated default (^src/\n^README\.md$) and a description explaining the format and purpose
  • Add ImportantFilePatterns property to Settings.schema.json as a top-level array of strings with a description
  • Pass the new input as PSMODULE_GET_SETTINGS_INPUT_ImportantFilePatterns environment variable in the action.yml composite step
  • In main.ps1, read the new environment variable and parse from newline-separated string to array
  • In main.ps1, add ImportantFilePatterns to the settings object construction with resolution: $settings.ImportantFilePatterns → parsed action input → hardcoded @('^src/', '^README\.md$')
  • Replace the hardcoded $importantPatterns variable (around line 258) with $settings.ImportantFilePatterns
  • Refactor the PR comment markdown table to generate rows dynamically from the resolved patterns instead of the current hardcoded table

Process-PSModule workflow

  • Add ImportantFilePatterns input to workflow.yml with matching type and description
  • Add ImportantFilePatterns input to Get-Settings.yml and pass it through to the Get-PSModuleSettings action step

Documentation

  • Update the Get-PSModuleSettings README with the new input and settings file property
  • Add an example to the settings file documentation showing how to override the default patterns

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions