Skip to content

Commit

Permalink
🪲 [Fix]: Add nightly run workflow (#10)
Browse files Browse the repository at this point in the history
## Description

- Add nightly run workflow

## 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
  • Loading branch information
MariusStorhaug authored Jun 30, 2024
1 parent 91297ae commit cbbb4c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 44 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/Nightly-Run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Nightly run

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

permissions:
contents: write
issues: write
pull-requests: write
statuses: write

jobs:
Process-PSModule:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v1
secrets: inherit
44 changes: 0 additions & 44 deletions tests/DynamicParams.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,54 +84,10 @@ Describe 'DynamicParams' {
Write-Verbose "EnvironmentVariable: $EnvironmentVariable"
}
}

filter Test-DynParam2 {
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet('A', 'B', 'C')]
[string]$Param1
)

DynamicParam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynVariable = @{
Name = 'Variable'
Type = [string]
ValidateSet = Get-Variable | Select-Object -ExpandProperty Name
DynamicParamDictionary = $DynamicParamDictionary
}
New-DynamicParam @dynVariable

$dynEnvironmentVariable = @{
Name = 'EnvironmentVariable'
Type = [string]
ValidateSet = Get-ChildItem -Path env: | Select-Object -ExpandProperty Name
DynamicParamDictionary = $DynamicParamDictionary
}
New-DynamicParam @dynEnvironmentVariable

return $DynamicParamDictionary
}

process {
$PSBoundParameters.Keys | ForEach-Object {
Set-Variable -Name $_ -Value $PSBoundParameters[$_]
}

Write-Verbose "Variable: $Variable"
Write-Verbose "EnvironmentVariable: $EnvironmentVariable"
}
}
}

It 'Test-DynParam should not throw an exception' {
{ Test-DynParam -Variable HOME -EnvironmentVariable RUNNER_OS -Verbose } | Should -Not -Throw
}

It 'Test-DynParam2 should not throw an exception' {
{ Test-DynParam2 -Variable HOME -EnvironmentVariable RUNNER_OS -Verbose } | Should -Not -Throw
}
}
}

0 comments on commit cbbb4c5

Please sign in to comment.