Skip to content

Commit 9cb9a61

Browse files
🩹 [Patch]: Make store 0.3 compatible (#8)
## Description - Make store 0.3 compatible ## 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 532d513 commit 9cb9a61

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

.github/workflows/Action-Test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ jobs:
5656
uses: ./
5757
with:
5858
Verbose: true
59-
Version: 0.3.118
60-
Token: ${{ github.token }}
59+
Version: 0.8.4
6160
Script: |
6261
LogGroup "Get-GitHubZen" {
6362
Get-GitHubZen
@@ -78,7 +77,6 @@ jobs:
7877
- name: Action-Test 1
7978
uses: ./
8079
with:
81-
Token: ${{ github.token }}
8280
Script: |
8381
LogGroup "Get-GitHubZen" {
8482
Get-GitHubZen
@@ -87,7 +85,6 @@ jobs:
8785
- name: Action-Test 2
8886
uses: ./
8987
with:
90-
Token: ${{ github.token }}
9188
Script: |
9289
LogGroup "Get-GitHubOctocat" {
9390
Get-GitHubOctocat

action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ runs:
4848
run: |
4949
# GitHub-Script
5050
. "${{ github.action_path }}\scripts\main.ps1"
51-
5251
${{ inputs.Script }}

scripts/main.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') {
88
$VerbosePreference = 'Continue'
99
}
1010

11-
Install-PSResource -Name 'Store' -Version 0.2.2 -Repository PSGallery -TrustRepository
11+
'::group::Setting up GitHub PowerShell module'
1212

1313
$Name = 'GitHub'
1414
$Version = [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Version) ? $null : $env:GITHUB_ACTION_INPUT_Version
1515
$Prerelease = $env:GITHUB_ACTION_INPUT_Prerelease -eq 'true'
1616

17-
if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) {
18-
Write-Verbose "Setting GITHUB_TOKEN to provided input 'Token'"
19-
$env:GITHUB_TOKEN = $env:GITHUB_ACTION_INPUT_Token
20-
}
21-
2217
$alreadyInstalled = Get-InstalledPSResource -Name $Name -ErrorAction SilentlyContinue
2318
if ($Version) {
2419
Write-Verbose "Filtering by version: $Version"
@@ -51,3 +46,17 @@ if (-not $alreadyImported) {
5146
Write-Verbose "Importing module: $Name"
5247
Import-Module -Name $Name
5348
}
49+
'::endgroup::'
50+
51+
LogGroup 'Connect-Github' {
52+
if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) {
53+
Write-Verbose "Setting GITHUB_TOKEN to provided input 'Token'"
54+
Connect-Github -Token $env:GITHUB_ACTION_INPUT_Token
55+
} elseif (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_ClientID) -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_PrivateKey)) {
56+
Write-Verbose "Setting ClientID and PEM to provided inputs 'ClientID' and 'PEM'"
57+
Connect-Github -ClientID $env:GITHUB_ACTION_INPUT_ClientID -PrivateKey $env:GITHUB_ACTION_INPUT_PrivateKey
58+
} elseif (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_JWT)) {
59+
Write-Verbose "Setting JWT to provided input 'JWT'"
60+
Connect-Github -JWT $env:GITHUB_ACTION_INPUT_JWT
61+
}
62+
}

0 commit comments

Comments
 (0)