-
Notifications
You must be signed in to change notification settings - Fork 170
Extract PowerShell code from E2E.yaml into local actions #2029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: mazhelez <[email protected]>
Co-authored-by: mazhelez <[email protected]>
Co-authored-by: mazhelez <[email protected]>
Co-authored-by: mazhelez <[email protected]>
| [string] $matrixStyle = '', | ||
| [Parameter(HelpMessage = "Matrix OS (windows or linux)", Mandatory = $false)] | ||
| [string] $matrixOs = '', | ||
| [Parameter(HelpMessage = "Admin center API credentials secret", Mandatory = $false)] |
Check warning
Code scanning / PSScriptAnalyzer
Parameter '$adminCenterApiCredentialsSecret' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information. Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please, fix
| [string] $e2ePrivateKey = '', | ||
| [Parameter(HelpMessage = "ALGOAUTHAPP secret value", Mandatory = $false)] | ||
| [string] $algoAuthApp = '', | ||
| [Parameter(HelpMessage = "adminCenterApiCredentials secret value", Mandatory = $false)] |
Check warning
Code scanning / PSScriptAnalyzer
Parameter '$adminCenterApiCredentials' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information. Warning
| [string] $adminCenterApiCredentials = '', | ||
| [Parameter(HelpMessage = "E2E_GHPackagesPAT secret value", Mandatory = $false)] | ||
| [string] $e2eGHPackagesPAT = '', | ||
| [Parameter(HelpMessage = "E2EAZURECREDENTIALS secret value", Mandatory = $false)] |
Check warning
Code scanning / PSScriptAnalyzer
Parameter '$e2eAzureCredentials' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information. Warning
| [string] $pteTemplate, | ||
| [Parameter(HelpMessage = "AppSource template", Mandatory = $true)] | ||
| [string] $appSourceTemplate, | ||
| [Parameter(HelpMessage = "Admin center API credentials", Mandatory = $true)] |
Check warning
Code scanning / PSScriptAnalyzer
Parameter '$adminCenterApiCredentials' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information. Warning
| [string] $appSourceTemplate, | ||
| [Parameter(HelpMessage = "Admin center API credentials", Mandatory = $true)] | ||
| [string] $adminCenterApiCredentials, | ||
| [Parameter(HelpMessage = "Azure credentials", Mandatory = $true)] |
Check warning
Code scanning / PSScriptAnalyzer
Parameter '$azureCredentials' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information. Warning
|
@copilot Would you please fix the code scanning issues, as well as the issues reported by the pre-commit check. |
Co-authored-by: mazhelez <[email protected]>
Fixed all code scanning and pre-commit issues: Pre-commit fixes:
Code quality improvements:
All pre-commit checks now pass, and scripts follow PowerShell best practices. Commit: e6a2b0d Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the E2E.yaml workflow by extracting 13 inline PowerShell code blocks into 7 reusable local composite actions, reducing the workflow file from 453 to 358 lines. The refactoring improves maintainability, reduces duplication, and adds proper error handling and PowerShell best practices to all scripts.
Key changes:
- Extracted secret validation, repository setup, test matrix generation, and test execution logic into separate actions
- Added error handling patterns with try-catch blocks and proper error propagation
- Standardized PowerShell script headers with
$ErrorActionPreference,$ProgressPreference, andSet-StrictMode
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/E2E.yaml | Replaced inline PowerShell blocks with calls to composite actions |
| .github/actions/E2ECheckSecrets/* | Action for validating required secrets and calculating test parameters |
| .github/actions/E2ESetupRepositories/* | Action for initializing test repositories |
| .github/actions/E2EAnalyze/* | Action for generating test matrices (public/private runs, releases, scenarios) |
| .github/actions/E2ECalculateRepoName/* | Action for generating random repository names |
| .github/actions/E2ECalculateTestParams/* | Action for resolving template and credential parameters |
| .github/actions/E2ERunScenario/* | Action for executing scenario tests |
| .github/actions/E2ERunTest/* | Action for executing Test-AL-Go.ps1 and Test-AL-Go-Upgrade.ps1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/workflows/E2E.yaml
Outdated
| env: | ||
| uses: ./.github/actions/E2ECheckSecrets | ||
| with: | ||
| shell: pwsh |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell input is not valid for composite actions. Composite actions define their shell in the action.yaml file. This line should be removed as it will be ignored by GitHub Actions and may cause confusion.
| shell: pwsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all invalid shell inputs from composite action calls. Composite actions define their shell in action.yaml, not as inputs. Also removed dead code in E2ECalculateTestParams.ps1 and moved contentPath calculation logic into the action to avoid duplication. Commit: 32499d0
.github/workflows/E2E.yaml
Outdated
| . (Join-Path "." "e2eTests/SetupRepositories.ps1") -githubOwner '${{ needs.Check.outputs.githubowner }}' -bcContainerHelperVersion $ENV:_bcContainerHelperVersion | ||
| uses: ./.github/actions/E2ESetupRepositories | ||
| with: | ||
| shell: pwsh |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell input is not valid for composite actions. Composite actions define their shell in the action.yaml file. This line should be removed.
| shell: pwsh |
.github/workflows/E2E.yaml
Outdated
| contentPath: ${{ matrix.type == 'appSourceApp' && 'appsourceapp' || 'pte' }} | ||
|
|
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contentPath is being calculated in the workflow using conditional expressions, but E2ECalculateTestParams action also has logic to calculate contentPath. This creates duplicate logic and potential inconsistency. Consider removing the inline calculation and letting the action handle it based on matrixType.
| contentPath: ${{ matrix.type == 'appSourceApp' && 'appsourceapp' || 'pte' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please fix the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed in commit 32499d0. The duplicate contentPath calculation has been removed from the workflow. The action now calculates contentPath based on matrixType, and the workflow uses the output value.
| elseif ($matrixType) { | ||
| # For upgrade tests or other scenarios | ||
| if ($matrixType -eq 'appSourceApp') { | ||
| $template = "$githubOwner/$appSourceAppRepo" | ||
| } | ||
| else { | ||
| $template = "$githubOwner/$perTenantExtensionRepo" | ||
| } | ||
| } |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 36-44 are unreachable dead code. If $matrixType is 'appSourceApp' or 'PTE', it's already handled by lines 30-35. The elseif block on line 36 will never execute. Remove lines 36-44.
| elseif ($matrixType) { | |
| # For upgrade tests or other scenarios | |
| if ($matrixType -eq 'appSourceApp') { | |
| $template = "$githubOwner/$appSourceAppRepo" | |
| } | |
| else { | |
| $template = "$githubOwner/$perTenantExtensionRepo" | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please do something about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed in commit 32499d0. The dead code (lines 36-44) has been removed and replaced with proper contentPath calculation logic.
Co-authored-by: mazhelez <[email protected]>
❔What, Why & How
Refactored E2E.yaml by extracting 13 inline PowerShell code blocks into 7 reusable local composite actions, reducing the workflow file from 453 to 358 lines. This improves maintainability, reduces duplication, and adds proper error handling and PowerShell best practices to all scripts.
Created Actions (in
.github/actions/):Each action includes PowerShell script with proper error handling, action.yaml descriptor, and README documentation. All actions are placed in
.github/actions/to avoid confusion with the actions that AL-Go ships. Actions call PowerShell scripts directly without wrapper layers.Code Quality Improvements:
$ErrorActionPreference = "Stop",$ProgressPreference = "SilentlyContinue", andSet-StrictMode -Version 2.0to all PowerShell scriptsshellinputs from composite action calls (composite actions define shell in action.yaml)Related to issue: [Issue number to be added]
✅ Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.