Skip to content

Commit e96fb15

Browse files
🪲 [Fix]: Fix script path and improve test result handling (#91)
## Description This pull request includes changes to the GitHub Actions workflow and the PowerShell script used for testing. The most important changes include updating the script path in the action configuration and modifying the handling of test results in the PowerShell script. ### Workflow Updates: * [`action.yml`](diffhunk://#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6L72-R72): Updated the script path in the `runs:` section to use a more straightforward syntax. ### Script Enhancements: * [`scripts/main.ps1`](diffhunk://#diff-dc2e5a659836b1b73abb03421c567f5018c2755677c4a0aa764cb26117b68011R53-R63): Improved the handling of test results by setting GitHub output values for passed tests and using a return variable to determine the exit code. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 7aaef7b commit e96fb15

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ runs:
6969
ShowOutput: true
7070
Script: |
7171
# Test-PSModule
72-
. (Join-Path -Path '${{ github.action_path }}' -ChildPath 'scripts\main.ps1')
72+
${{ github.action_path }}/scripts/main.ps1
7373
7474
- name: Upload test results
7575
uses: actions/upload-artifact@v4

scripts/main.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ $failedTests = [int]$testResults.FailedCount
5050

5151
if (($failedTests -gt 0) -or ($testResults.Result -ne 'Passed')) {
5252
Write-GitHubError "❌ Some [$failedTests] tests failed."
53+
Set-GitHubOutput -Name 'passed' -Value $false
54+
$return = 1
5355
}
5456
if ($failedTests -eq 0) {
5557
Write-GitHubNotice '✅ All tests passed.'
58+
Set-GitHubOutput -Name 'passed' -Value $true
59+
$return = 0
5660
}
5761

58-
Set-GitHubOutput -Name 'passed' -Value ($failedTests -eq 0)
5962
Write-Host '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
60-
exit $failedTests
63+
exit $return

0 commit comments

Comments
 (0)