Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/Get-Settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ on:
description: The path to the root of the repo.
required: false
default: '.'
ImportantFilePatterns:
type: string
description: |
Newline-separated list of regex patterns that identify important files.
Changes matching these patterns trigger build, test, and publish stages.
When set, fully replaces the defaults (^src/ and ^README\.md$).
required: false
Comment thread
MariusStorhaug marked this conversation as resolved.
default: |
^src/
^README\.md$
Comment thread
MariusStorhaug marked this conversation as resolved.

outputs:
Settings:
Expand All @@ -56,7 +66,7 @@ jobs:
fetch-depth: 0

- name: Get-Settings
uses: PSModule/Get-PSModuleSettings@21c88f499579f56a60cced37872089d866b94a66 # v1.4.4
uses: PSModule/Get-PSModuleSettings@1e3d156786c56e6fbd839a1ba5ab21ff8858090e # v1.5.0
id: Get-Settings
with:
SettingsPath: ${{ inputs.SettingsPath }}
Expand All @@ -65,3 +75,4 @@ jobs:
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
WorkingDirectory: ${{ inputs.WorkingDirectory }}
ImportantFilePatterns: ${{ inputs.ImportantFilePatterns }}
11 changes: 11 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ on:
description: The path to the root of the repo.
required: false
default: '.'
ImportantFilePatterns:
type: string
description: |
Newline-separated list of regex patterns that identify important files.
Changes matching these patterns trigger build, test, and publish stages.
When set, fully replaces the defaults (^src/ and ^README\.md$).
required: false
Comment thread
MariusStorhaug marked this conversation as resolved.
Comment thread
MariusStorhaug marked this conversation as resolved.
default: |
^src/
^README\.md$
Comment thread
MariusStorhaug marked this conversation as resolved.

permissions:
contents: write # to checkout the repo and create releases on the repo
Expand All @@ -81,6 +91,7 @@ jobs:
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
WorkingDirectory: ${{ inputs.WorkingDirectory }}
ImportantFilePatterns: ${{ inputs.ImportantFilePatterns }}

# Runs on:
# - ✅ Open/Updated PR - Lints code changes in active PRs
Expand Down
61 changes: 55 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ jobs:
| `Version` | `string` | Specifies the version of the GitHub module to be installed. The value must be an exact version. | `false` | `''` |
| `Prerelease` | `boolean` | Whether to use a prerelease version of the 'GitHub' module. | `false` | `false` |
| `WorkingDirectory` | `string` | The path to the root of the repo. | `false` | `'.'` |
| `ImportantFilePatterns` | `string` | Newline-separated list of regular expression patterns that identify important files. Changes matching these patterns trigger build, test, and publish stages. When set, fully replaces the defaults. | `false` | `^src/` and `^README\.md$` |
Comment thread
MariusStorhaug marked this conversation as resolved.
Outdated

### Secrets

Expand Down Expand Up @@ -456,12 +457,55 @@ The workflow automatically detects whether a pull request contains changes to "i
release. This prevents unnecessary releases when only non-functional files (such as workflow configurations, linter
settings, or test files) are modified.

#### Files that trigger releases
#### Default patterns
Comment thread
MariusStorhaug marked this conversation as resolved.
Outdated

| Path | Description |
By default, the following regular expression patterns identify important files:

| Pattern | Description |
| :--- | :---------- |
| `src/**` | Module source code |
| `README.md` | Module documentation |
| `^src/` | Module source code |
| `^README\.md$` | Module documentation |
Comment thread
MariusStorhaug marked this conversation as resolved.
Comment thread
MariusStorhaug marked this conversation as resolved.

#### Customizing important file patterns

To override the default patterns, set `ImportantFilePatterns` in your settings file (`.github/PSModule.yml`):

```yaml
Comment thread
MariusStorhaug marked this conversation as resolved.
ImportantFilePatterns:
- '^src/'
- '^README\.md$'
- '^examples/'
Comment thread
MariusStorhaug marked this conversation as resolved.
```

When configured, the provided list fully replaces the defaults. Include the default patterns in your list if you still
want them to trigger releases.

Comment thread
MariusStorhaug marked this conversation as resolved.
To disable file-change triggering entirely (so that no file changes ever trigger a release), set an empty list in the
settings file:

```yaml
ImportantFilePatterns: []
```

You can also pass patterns via the workflow input:

```yaml
jobs:
Process:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
with:
ImportantFilePatterns: |
^src/
^README\.md$
^examples/
```

To disable triggering via workflow input, pass an explicit empty string. Note that omitting the input entirely causes
the workflow's default patterns (`^src/` and `^README\.md$`) to be used — the settings file takes priority over the
Comment thread
MariusStorhaug marked this conversation as resolved.
Outdated
workflow input, so set `ImportantFilePatterns: []` in `.github/PSModule.yml` to disable triggering regardless of the
workflow input.
Comment thread
MariusStorhaug marked this conversation as resolved.
Outdated

Resolution order: settings file → workflow input → hardcoded defaults.
Comment thread
MariusStorhaug marked this conversation as resolved.
Outdated

#### Files that do NOT trigger releases

Expand All @@ -470,14 +514,14 @@ Changes to the following files will not trigger a release:
- `.github/workflows/*` - Workflow configurations
- `.github/linters/*` - Linter configuration files
- `tests/**` - Test files
- `examples/**` - Example scripts
- `.gitignore`, `.editorconfig`, etc. - Repository configuration files

#### Behavior when no important files are changed

When a pull request does not contain changes to important files:

1. A comment is automatically added to the PR explaining why build/test stages are skipped
1. A comment is automatically added to the PR listing the configured patterns and explaining why build/test stages are
skipped
2. The `ReleaseType` output is set to `None`
3. Build, test, and publish stages are skipped
4. The PR can still be merged for non-release changes (documentation updates, CI improvements, etc.)
Expand All @@ -495,6 +539,7 @@ The following settings are available in the settings file:
| Name | Type | Description | Default |
| ----------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| `Name` | `String` | Name of the module to publish. Defaults to the repository name. | `null` |
| `ImportantFilePatterns` | `Array` | Regular expression patterns that identify important files. Changes matching these patterns trigger build, test, and publish stages. When set, fully replaces the defaults. | `['^src/', '^README\.md$']` |
| `Test.Skip` | `Boolean` | Skip all tests | `false` |
| `Test.Linux.Skip` | `Boolean` | Skip tests on Linux | `false` |
| `Test.MacOS.Skip` | `Boolean` | Skip tests on macOS | `false` |
Expand Down Expand Up @@ -543,6 +588,10 @@ The following settings are available in the settings file:
```yaml
Name: null

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

Build:
Skip: false
Module:
Expand Down
Loading