Skip to content

Commit 48e91f5

Browse files
🚀[Feature]: Enhance workflow orchestration with detailed Get-Settings phase description and context-aware execution
1 parent eaf0f30 commit 48e91f5

File tree

2 files changed

+67
-8
lines changed

2 files changed

+67
-8
lines changed

.specify/memory/constitution.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,23 @@ Pull requests MUST use labels to determine release behavior:
458458

459459
### Workflow Conditional Execution
460460

461-
The Process-PSModule workflow uses **dynamic conditions** to determine job execution:
461+
The Process-PSModule workflow uses **dynamic conditions** to determine job execution, controlled by the **Get-Settings** phase.
462+
463+
#### Get-Settings Phase: Workflow Orchestration
464+
465+
The **Get-Settings** phase serves as the orchestration layer that:
466+
467+
- **Collects Configuration**: Loads settings from `.github/PSModule.yml` (or JSON/PSD1)
468+
- **Analyzes Context**: Examines GitHub event type, PR state, labels, and repository structure
469+
- **Makes Smart Decisions**: Determines which workflow jobs should execute based on collected data
470+
- **Prepares Test Matrices**: Generates dynamic test suite configurations for parallel execution
471+
- **Optimizes Execution**: Skips unnecessary jobs to reduce CI/CD runtime and resource usage
472+
473+
The Get-Settings phase embodies the principle of **context-aware workflow execution**, ensuring that each workflow run performs only the necessary tasks based on the current state and configuration.
462474

463475
#### Always Execute (All PR States)
464476

465-
- **Get-Settings** - Configuration loading
477+
- **Get-Settings** - Configuration loading and workflow orchestration
466478
- **Build-Module** - Module compilation
467479
- **Build-Docs** - Documentation generation
468480
- **Build-Site** - Static site generation
@@ -667,7 +679,12 @@ jobs:
667679
### Workflow Execution Order
668680

669681
The standard execution order for Process-PSModule workflows MUST be:
670-
1. **Get-Settings** - Reads configuration and prepares test matrices
682+
1. **Gather** - Reads configuration, analyzes context, and prepares workflow execution plan
683+
- Loads settings from `.github/PSModule.yml` (or JSON/PSD1)
684+
- Examines GitHub event type, PR state, and labels
685+
- Generates dynamic test matrices for parallel execution
686+
- Determines which jobs should execute based on configuration and context
687+
- Provides intelligent deployment orchestration for CI/CD workflows
671688
2. **Build-Module** - Compiles source into module
672689
3. **Test-SourceCode** - Parallel matrix testing of source code standards
673690
4. **Lint-SourceCode** - Parallel matrix linting of source code

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ Depending on the labels in the pull requests, the workflow will result in differ
2424

2525
![Process diagram](./media/Process-PSModule.png)
2626

27-
- [Get settings](./.github/workflows/Get-Settings.yml)
28-
- Reads the settings file from a file in the module repository to configure the workflow.
29-
- Gathers tests and creates test configuration based on the settings and the tests available in the module repository.
30-
- This includes the selection of what OSes to run the tests on.
27+
- [Get-Settings](./.github/workflows/Get-Settings.yml)
28+
- **Workflow orchestration phase** that analyzes context and makes smart execution decisions
29+
- **Collects Configuration**: Reads the settings file from `.github/PSModule.yml` (or JSON/PSD1) to configure the workflow
30+
- **Analyzes Context**: Examines GitHub event type, PR state, labels, and repository structure
31+
- **Makes Smart Decisions**: Determines which workflow jobs should execute based on collected data
32+
- **Prepares Test Matrices**: Generates dynamic test suite configurations for parallel execution across OSes
33+
- **Optimizes Execution**: Skips unnecessary jobs to reduce CI/CD runtime and resource usage
34+
- This phase embodies context-aware workflow execution, ensuring each run performs only necessary tasks
3135
- [Build module](./.github/workflows/Build-Module.yml)
3236
- Compiles the module source code into a PowerShell module.
3337
- [Test source code](./.github/workflows/Test-SourceCode.yml)
@@ -68,6 +72,44 @@ Depending on the labels in the pull requests, the workflow will result in differ
6872
- Publishes the module to the PowerShell Gallery.
6973
- Creates a release on the GitHub repository.
7074

75+
## Gather Phase: Workflow Orchestration
76+
77+
The **Gather** phase is the cornerstone of Process-PSModule's workflow execution, providing context-aware orchestration for CI/CD pipelines.
78+
79+
### Philosophy
80+
81+
The Gather phase embodies the principle of **deployment orchestration**:
82+
83+
- **Discovers the Environment**: Analyzes the GitHub context (event type, PR state, labels, branch)
84+
- **Loads Configuration**: Reads settings from `.github/PSModule.yml` (or JSON/PSD1 format)
85+
- **Makes Context-Aware Decisions**: Determines which jobs should execute based on collected data
86+
- **Optimizes Resource Usage**: Skips unnecessary steps to reduce CI/CD runtime and costs
87+
- **Prepares Execution Plan**: Generates dynamic test matrices for parallel execution across platforms
88+
89+
### What Gather Does
90+
91+
1. **Configuration Loading**: Imports settings with fallback to defaults
92+
2. **Context Analysis**: Examines whether the workflow is running on:
93+
- Open/Updated PR (build and test for validation)
94+
- Merged PR (publish release and deploy site)
95+
- Abandoned PR (cleanup only)
96+
- Manual/Scheduled run (validation only)
97+
3. **Test Matrix Generation**: Creates OS-specific test configurations based on:
98+
- Available test files in the repository
99+
- Skip flags in settings
100+
- Test type requirements (SourceCode, PSModule, Module)
101+
4. **Decision Output**: Produces structured outputs that control downstream job execution
102+
103+
### Key Benefits
104+
105+
- **Consistency**: Same logic across all consuming repositories
106+
- **Efficiency**: Only runs necessary jobs for each scenario
107+
- **Flexibility**: Easy to customize via settings file
108+
- **Transparency**: Clear decision-making visible in workflow logs
109+
- **Maintainability**: Centralized orchestration logic
110+
111+
This approach ensures that each workflow run is optimized for its specific context, reducing unnecessary work while maintaining comprehensive validation when needed.
112+
71113
## Usage
72114

73115
To use the workflow, create a new file in the `.github/workflows` directory of the module repository and add the following content.
@@ -202,7 +244,7 @@ This table shows when each job runs based on the trigger scenario:
202244
203245
| Job | Open/Updated PR | Merged PR | Abandoned PR | Manual Run |
204246
|-----|-----------------|-----------|--------------|------------|
205-
| **Get-Settings** | ✅ Always | ✅ Always | ✅ Always | ✅ Always |
247+
| **Gather** | ✅ Always | ✅ Always | ✅ Always | ✅ Always |
206248
| **Lint-Repository** | ✅ Yes | ❌ No | ❌ No | ❌ No |
207249
| **Build-Module** | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
208250
| **Build-Docs** | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes |

0 commit comments

Comments
 (0)