Skip to content

Commit

Permalink
Add pwsh-switch-parameter workflow (#11)
Browse files Browse the repository at this point in the history
* Add pwsh-switch-parameter workflow

* Altered path to script

* Altered path to script

* Reordered parameters

* Moved params to single line

* Removed switch

* Multilined with backtick

* Reordered params with switch in the middle
  • Loading branch information
NickGraham101 authored Apr 11, 2022
1 parent 8ca3644 commit 2cb6cf5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/scripts/Test-SwitchParameter.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env pwsh
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$ThisDoesNothing,
[Parameter(Mandatory=$false)]
[switch]$ThisIsASwitch,
[Parameter(Mandatory=$true)]
[string]$MoreNothing
)

$InformationPreference = "Continue"

if ($ThisIsASwitch.IsPresent) {
Write-Information "There is a switch present."
}
else {
Write-Information "There isn't a switch!"
}
1 change: 0 additions & 1 deletion .github/workflows/default-matrix-values.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: DefaultMatrixValues

on:
pull_request:
workflow_dispatch:

jobs:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pwsh-switch-parameter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PowerShellSwitchParameter

on:
pull_request:
workflow_dispatch:

jobs:
run-pwsh-script:
name: Run powershell script
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Test-SwitchParameter
shell: pwsh
run: |
./.github/scripts/Test-SwitchParameter.ps1 `
-ThisDoesNothing "Nothing" `
-ThisIsASwitch `
-MoreNothing "More nothing"

0 comments on commit 2cb6cf5

Please sign in to comment.