Skip to content

Commit 532d513

Browse files
🩹 [Patch]: Add nightly run (#7)
## Description - Add nightly run - Added some bugfix caused by GitHub module built for Store 0.2.2, not the latest version of Store (0.3.0). ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [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 9053af3 commit 532d513

File tree

3 files changed

+20
-63
lines changed

3 files changed

+20
-63
lines changed

.github/workflows/Action-Test.yml

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: Action-Test
22

33
run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
44

5-
on: [pull_request]
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
schedule:
9+
- cron: '0 0 * * *'
610

711
concurrency:
812
group: ${{ github.workflow }}-${{ github.ref }}
@@ -35,58 +39,11 @@ jobs:
3539
- name: Action-Test
3640
uses: ./
3741
with:
38-
Verbose: true
3942
Script: |
4043
LogGroup "My group" {
4144
"This is a group"
4245
}
4346
44-
ActionTestWithGitHubToken:
45-
name: Action-Test - [WithGitHubToken]
46-
runs-on: ubuntu-latest
47-
env:
48-
GITHUB_TOKEN: ${{ github.token }}
49-
steps:
50-
# Need to check out as part of the test, as its a local action
51-
- name: Checkout repo
52-
uses: actions/checkout@v4
53-
54-
- name: Action-Test
55-
uses: ./
56-
with:
57-
Verbose: true
58-
Script: |
59-
LogGroup "Get-GitHubZen" {
60-
Get-GitHubZen
61-
}
62-
63-
LogGroup "Get-GitHubOctocat" {
64-
Get-GitHubOctocat
65-
}
66-
67-
ActionTestWithToken:
68-
name: Action-Test - [WithToken]
69-
runs-on: ubuntu-latest
70-
steps:
71-
# Need to check out as part of the test, as its a local action
72-
- name: Checkout repo
73-
uses: actions/checkout@v4
74-
75-
- name: Action-Test
76-
uses: ./
77-
with:
78-
Token: ${{ github.token }}
79-
Verbose: true
80-
Script: |
81-
LogGroup "Get-GitHubZen" {
82-
Get-GitHubZen
83-
}
84-
85-
LogGroup "Get-GitHubOctocat" {
86-
Get-GitHubOctocat
87-
}
88-
89-
9047
ActionTestWithVersion:
9148
name: Action-Test - [WithVersion]
9249
runs-on: ubuntu-latest
@@ -98,9 +55,9 @@ jobs:
9855
- name: Action-Test
9956
uses: ./
10057
with:
101-
Token: ${{ github.token }}
10258
Verbose: true
10359
Version: 0.3.118
60+
Token: ${{ github.token }}
10461
Script: |
10562
LogGroup "Get-GitHubZen" {
10663
Get-GitHubZen
@@ -122,7 +79,6 @@ jobs:
12279
uses: ./
12380
with:
12481
Token: ${{ github.token }}
125-
Verbose: true
12682
Script: |
12783
LogGroup "Get-GitHubZen" {
12884
Get-GitHubZen
@@ -132,7 +88,6 @@ jobs:
13288
uses: ./
13389
with:
13490
Token: ${{ github.token }}
135-
Verbose: true
13691
Script: |
13792
LogGroup "Get-GitHubOctocat" {
13893
Get-GitHubOctocat
@@ -141,8 +96,6 @@ jobs:
14196
- name: Action-Test 3
14297
uses: ./
14398
with:
144-
Token: ${{ github.token }}
145-
Verbose: true
14699
Script: |
147100
LogGroup "Get-GitHubRateLimit" {
148101
Get-GitHubRateLimit

action.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ inputs:
1010
description: The script to run.
1111
required: false
1212
Token:
13-
description: The GitHub token to use. This will override the default behavior of using the `GITHUB_TOKEN` environment variable.
13+
description: The access token to use.
1414
required: false
15+
default: ${{ github.token }}
1516
Debug:
1617
description: Enable debug output.
1718
required: false
@@ -46,12 +47,6 @@ runs:
4647
GITHUB_ACTION_INPUT_Prerelease: ${{ inputs.Prerelease }}
4748
run: |
4849
# GitHub-Script
49-
if ($env:GITHUB_ACTION_INPUT_Debug -eq 'true') {
50-
$DebugPreference = 'Continue'
51-
}
52-
if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') {
53-
$VerbosePreference = 'Continue'
54-
}
5550
. "${{ github.action_path }}\scripts\main.ps1"
5651
5752
${{ inputs.Script }}

scripts/main.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
[CmdletBinding()]
22
param()
33

4+
if ($env:GITHUB_ACTION_INPUT_Debug -eq 'true') {
5+
$DebugPreference = 'Continue'
6+
}
7+
if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') {
8+
$VerbosePreference = 'Continue'
9+
}
10+
11+
Install-PSResource -Name 'Store' -Version 0.2.2 -Repository PSGallery -TrustRepository
12+
413
$Name = 'GitHub'
514
$Version = [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Version) ? $null : $env:GITHUB_ACTION_INPUT_Version
615
$Prerelease = $env:GITHUB_ACTION_INPUT_Prerelease -eq 'true'
@@ -16,10 +25,10 @@ if ($Version) {
1625
$alreadyInstalled = $alreadyInstalled | Where-Object Version -EQ $Version
1726
}
1827
if ($Prerelease) {
19-
Write-Verbose "Filtering by prerelease"
28+
Write-Verbose 'Filtering by prerelease'
2029
$alreadyInstalled = $alreadyInstalled | Where-Object Prerelease -EQ $Prerelease
2130
}
22-
Write-Verbose "Already installed:"
31+
Write-Verbose 'Already installed:'
2332
Write-Verbose ($alreadyInstalled | Format-Table | Out-String)
2433
if (-not $alreadyInstalled) {
2534
Write-Verbose "Installing module. Name: [$Name], Version: [$Version], Prerelease: [$Prerelease]"
@@ -36,7 +45,7 @@ if (-not $alreadyInstalled) {
3645
}
3746

3847
$alreadyImported = Get-Module -Name $Name
39-
Write-Verbose "Already imported:"
48+
Write-Verbose 'Already imported:'
4049
Write-Verbose ($alreadyImported | Format-Table | Out-String)
4150
if (-not $alreadyImported) {
4251
Write-Verbose "Importing module: $Name"

0 commit comments

Comments
 (0)