Skip to content

🩹 [Patch]: Make store 0.3 compatible #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/Action-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ jobs:
uses: ./
with:
Verbose: true
Version: 0.3.118
Token: ${{ github.token }}
Version: 0.8.4
Script: |
LogGroup "Get-GitHubZen" {
Get-GitHubZen
Expand All @@ -78,7 +77,6 @@ jobs:
- name: Action-Test 1
uses: ./
with:
Token: ${{ github.token }}
Script: |
LogGroup "Get-GitHubZen" {
Get-GitHubZen
Expand All @@ -87,7 +85,6 @@ jobs:
- name: Action-Test 2
uses: ./
with:
Token: ${{ github.token }}
Script: |
LogGroup "Get-GitHubOctocat" {
Get-GitHubOctocat
Expand Down
1 change: 0 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ runs:
run: |
# GitHub-Script
. "${{ github.action_path }}\scripts\main.ps1"

${{ inputs.Script }}
21 changes: 15 additions & 6 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') {
$VerbosePreference = 'Continue'
}

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

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

if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) {
Write-Verbose "Setting GITHUB_TOKEN to provided input 'Token'"
$env:GITHUB_TOKEN = $env:GITHUB_ACTION_INPUT_Token
}

$alreadyInstalled = Get-InstalledPSResource -Name $Name -ErrorAction SilentlyContinue
if ($Version) {
Write-Verbose "Filtering by version: $Version"
Expand Down Expand Up @@ -51,3 +46,17 @@ if (-not $alreadyImported) {
Write-Verbose "Importing module: $Name"
Import-Module -Name $Name
}
'::endgroup::'

LogGroup 'Connect-Github' {
if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Token)) {
Write-Verbose "Setting GITHUB_TOKEN to provided input 'Token'"
Connect-Github -Token $env:GITHUB_ACTION_INPUT_Token
} elseif (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_ClientID) -and -not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_PrivateKey)) {
Write-Verbose "Setting ClientID and PEM to provided inputs 'ClientID' and 'PEM'"
Connect-Github -ClientID $env:GITHUB_ACTION_INPUT_ClientID -PrivateKey $env:GITHUB_ACTION_INPUT_PrivateKey
} elseif (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_JWT)) {
Write-Verbose "Setting JWT to provided input 'JWT'"
Connect-Github -JWT $env:GITHUB_ACTION_INPUT_JWT
}
}