diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 5853f21..e6bed48 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -24,16 +24,8 @@ jobs: - name: Action-Test uses: ./ with: - script: | - LogGroup "Test-PSModule" { - Get-GitHubZen - } - - - name: Action-Test 2 - uses: ./ - with: - Verbose: true - script: | - LogGroup "Test-PSModule" { + Token: ${{ github.token }} + Script: | + LogGroup "Get-GitHubZen" { Get-GitHubZen } diff --git a/README.md b/README.md index b057339..3ae05b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GitHub-Script -A GitHub Action used for running a PowerShell Script that uses the GitHub PowerShell module +A GitHub Action used for running a PowerShell Script that uses the GitHub PowerShell module. ## Usage @@ -12,35 +12,52 @@ A GitHub Action used for running a PowerShell Script that uses the GitHub PowerS | `Token` | The GitHub token to use | false | ${{ github.token }} | | `Debug` | Enable debug output | false | 'false' | | `Verbose` | Enable verbose output | false | 'false' | -| `Version` | The version of the GitHub module to install | false | 'latest' | +| `Version` | Specifies the version of the resource to be returned. The value can be an exact version or a version range using the NuGet versioning syntax. | false | 'latest' | | `Prerelease` | Allow prerelease versions if available | false | 'false' | | `WorkingDirectory` | The working directory where the script will run from | false | ${{ github.workspace }} | - +### Examples - +#### Example 1: Run a script that uses the GitHub PowerShell module - +Run a script that uses the GitHub PowerShell module. +This example runs a non-authenticated script that gets the GitHub Zen message. - +```yaml +jobs: + Run-Script: + runs-on: ubuntu-latest + steps: + - name: Run script + uses: PSModule/GitHub-Script@v1 + with: + Script: | + LogGroup "Get-GitHubZen" { + Get-GitHubZen + } +``` + +#### Example 2: Run a script that uses the GitHub PowerShell module with a token -### Example +Run a script that uses the GitHub PowerShell module with a token. +This example runs an authenticated script that gets the GitHub Zen message. ```yaml -Example here +jobs: + Run-Script: + runs-on: ubuntu-latest + steps: + - name: Run script + uses: PSModule/GitHub-Script@v1 + with: + Token: ${{ github.token }} + Script: | + LogGroup "Get-GitHubZen" { + Get-GitHubZen + } ``` -### Similar projects +## Related projects - [actions/create-github-app-token](https://github.com/actions/create-github-app-token) -> Functionality will be brought into GitHub PowerShell module. - [actions/github-script](https://github.com/actions/github-script) diff --git a/action.yml b/action.yml index c80c9dd..26eef8d 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,6 @@ inputs: Token: description: The GitHub token to use. required: false - default: ${{ github.token }} Debug: description: Enable debug output. required: false @@ -55,6 +54,6 @@ runs: if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') { $VerbosePreference = 'Continue' } - . "$env:GITHUB_ACTION_PATH\scripts\main.ps1" + . "${{ github.action_path }}\scripts\main.ps1" ${{ inputs.Script }} diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index a570e4d..0000000 --- a/tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Placeholder for tests - -Location for tests of the action.