From c9071226c73c57481b8ed8f5ce3b3637f73e0308 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:14:16 +0200 Subject: [PATCH 1/6] test --- .github/workflows/Action-Test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 5853f21..23fc360 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -37,3 +37,12 @@ jobs: LogGroup "Test-PSModule" { Get-GitHubZen } + + - name: Action-Test PAT + uses: ./ + with: + Token: ${{ secrets.PAT }} + script: | + LogGroup "Test-PSModule" { + Get-GitHubZen + } From b0ead50dc87000ed6d9288c9ed2c315816fe6b24 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:15:41 +0200 Subject: [PATCH 2/6] test --- .github/workflows/Action-Test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 23fc360..a82ead7 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -35,7 +35,7 @@ jobs: Verbose: true script: | LogGroup "Test-PSModule" { - Get-GitHubZen + Get-GitHubUser } - name: Action-Test PAT @@ -44,5 +44,5 @@ jobs: Token: ${{ secrets.PAT }} script: | LogGroup "Test-PSModule" { - Get-GitHubZen + Get-GitHubUser } From c9172308e13978951675628ef4c81c218847c87e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:25:43 +0200 Subject: [PATCH 3/6] Fix --- .github/workflows/Action-Test.yml | 18 ----------- README.md | 51 ++++++++++++++++++++----------- action.yml | 3 +- tests/README.md | 3 -- 4 files changed, 35 insertions(+), 40 deletions(-) delete mode 100644 tests/README.md diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index a82ead7..a05e7f5 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -28,21 +28,3 @@ jobs: LogGroup "Test-PSModule" { Get-GitHubZen } - - - name: Action-Test 2 - uses: ./ - with: - Verbose: true - script: | - LogGroup "Test-PSModule" { - Get-GitHubUser - } - - - name: Action-Test PAT - uses: ./ - with: - Token: ${{ secrets.PAT }} - script: | - LogGroup "Test-PSModule" { - Get-GitHubUser - } diff --git a/README.md b/README.md index b057339..e4eb5fd 100644 --- a/README.md +++ b/README.md @@ -12,32 +12,49 @@ 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 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. From 53121f6e3984ba0ad06ce4c2ca97ceb2ab899d17 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:27:17 +0200 Subject: [PATCH 4/6] Fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4eb5fd..8b9f3e3 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 From cc36a5dfdbc8e8d2eb6e1cd7e67e447a7f93bd19 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:29:01 +0200 Subject: [PATCH 5/6] run with token --- .github/workflows/Action-Test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index a05e7f5..6c9e591 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -24,7 +24,8 @@ jobs: - name: Action-Test uses: ./ with: - script: | + Token: ${{ github.token }} + Script: | LogGroup "Test-PSModule" { Get-GitHubZen } From 3e7bb44fb500a71815f8386b9dce2ce40c784621 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 Aug 2024 21:41:10 +0200 Subject: [PATCH 6/6] Fix md and yml lint issues --- .github/workflows/Action-Test.yml | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index 6c9e591..e6bed48 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -26,6 +26,6 @@ jobs: with: Token: ${{ github.token }} Script: | - LogGroup "Test-PSModule" { + LogGroup "Get-GitHubZen" { Get-GitHubZen } diff --git a/README.md b/README.md index 8b9f3e3..3ae05b1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A GitHub Action used for running a PowerShell Script that uses the GitHub PowerS ### Examples -#### Example 1: Run a script that uses the GitHub PowerShell module. +#### 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. @@ -37,7 +37,7 @@ jobs: } ``` -#### Example 2: Run a script that uses the GitHub PowerShell module with a token. +#### Example 2: Run a script that uses the GitHub PowerShell module with a token Run a script that uses the GitHub PowerShell module with a token. This example runs an authenticated script that gets the GitHub Zen message. @@ -57,7 +57,7 @@ jobs: } ``` -### 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)