Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion .github/workflows/Get-Settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ 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

outputs:
Settings:
Expand All @@ -56,7 +63,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 +72,4 @@ jobs:
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
WorkingDirectory: ${{ inputs.WorkingDirectory }}
ImportantFilePatterns: ${{ inputs.ImportantFilePatterns }}
8 changes: 8 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ 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

permissions:
contents: write # to checkout the repo and create releases on the repo
Expand All @@ -81,6 +88,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
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,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$` |

### Secrets

Expand Down Expand Up @@ -445,12 +446,43 @@ 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

| 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 |

#### Customizing important file patterns

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

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

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

You can also pass patterns via the workflow input:

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

Resolution order: settings file β†’ workflow input β†’ hardcoded defaults.

#### Files that do NOT trigger releases

Expand All @@ -459,14 +491,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

Comment on lines 487 to 495
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Coilot Lets remove this section, as we already are describing what is being included.

#### 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 @@ -484,6 +516,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 @@ -532,6 +565,10 @@ The following settings are available in the settings file:
```yaml
Name: null

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

Build:
Skip: false
Module:
Expand Down
Loading