Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/Action-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ jobs:
"This is a group"
}

ActionTestWithGitHubToken:
name: Action-Test - [WithGitHubToken]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
# Need to check out as part of the test, as its a local action
- name: Checkout repo
uses: actions/checkout@v4

- name: Action-Test
uses: ./
with:
Verbose: true
Script: |
LogGroup "Get-GitHubZen" {
Get-GitHubZen
}

LogGroup "Get-GitHubOctocat" {
Get-GitHubOctocat
}

ActionTestWithToken:
name: Action-Test - [WithToken]
runs-on: ubuntu-latest
Expand All @@ -63,6 +86,7 @@ jobs:
Get-GitHubOctocat
}


ActionTestWithVersion:
name: Action-Test - [WithVersion]
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For more information on the available functions and automatic loaded variables,
| Name | Description | Required | Default |
| - | - | - | - |
| `Script` | The script to run | false | |
| `Token` | The GitHub token to use | false | `${{ github.token }}` |
| `Token` | The GitHub token to use. This will override the default behavior of using the `GITHUB_TOKEN` environment variable. | false | `${{ github.token }}` |
| `Debug` | Enable debug output | false | `'false'` |
| `Verbose` | Enable verbose output | false | `'false'` |
| `Version` | Specifies the version of the GitHub module to be installed. The value must be an exact version. | false | |
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
description: The script to run.
required: false
Token:
description: The GitHub token to use.
description: The GitHub token to use. This will override the default behavior of using the `GITHUB_TOKEN` environment variable.
required: false
Debug:
description: Enable debug output.
Expand Down Expand Up @@ -39,7 +39,7 @@ runs:
shell: pwsh
working-directory: ${{ inputs.WorkingDirectory }}
env:
GITHUB_TOKEN: ${{ inputs.Token }}
GITHUB_ACTION_INPUT_Token: ${{ inputs.Token }}
GITHUB_ACTION_INPUT_Debug: ${{ inputs.Debug }}
GITHUB_ACTION_INPUT_Verbose: ${{ inputs.Verbose }}
GITHUB_ACTION_INPUT_Version: ${{ inputs.Version }}
Expand Down
5 changes: 5 additions & 0 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ $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