From 030d02d63320e41f11b0f796e8b5b54f9e873dab Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 9 Dec 2024 17:56:32 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Action-Tes?= =?UTF-8?q?t=20workflow=20to=20simplify=20steps=20and=20enhance=20debuggin?= =?UTF-8?q?g=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Action-Test.yml | 254 +++++++++++++++--------------- 1 file changed, 129 insertions(+), 125 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index bbd12ae..4cb903d 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -20,113 +20,6 @@ jobs: ActionTestBasic: name: Action-Test - [Basic] runs-on: ubuntu-latest - 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: ./ - - ActionTestWithScript: - name: Action-Test - [WithScript] - runs-on: ubuntu-latest - 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: - Script: | - LogGroup 'Get-GitHubZen' { - Get-GitHubZen - } - - ActionTestCommands: - name: Action-Test - [Commands] - runs-on: ubuntu-latest - 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: ./ - id: test - with: - Prerelease: true - Script: | - $cat = Get-GitHubOctocat - $zen = Get-GitHubZen - Set-GitHubEnvironmentVariable -Name 'OCTOCAT' -Value $cat - Set-GitHubOutput -Name 'WISECAT' -Value $cat - Set-GitHubOutput -Name 'Zen' -Value $zen - - - name: Run-test - shell: pwsh - env: - result: ${{ steps.test.outputs.result }} - run: | - $result = $env:result | ConvertFrom-Json - Set-GitHubStepSummary -Summary $result.WISECAT - Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' - - ActionTestWithoutToken: - name: Action-Test - [WithoutToken] - runs-on: ubuntu-latest - 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: - Token: '' - Script: | - LogGroup 'My group' { - 'This is a group' - } - - ActionTestWithPAT: - name: Action-Test - [WithPAT] - runs-on: ubuntu-latest - 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: - Token: ${{ secrets.TEST_PAT }} - Script: | - LogGroup 'Get-GitHubUser' { - Get-GitHubUser | Format-Table -AutoSize - } - - ActionTestWithFGPAT: - name: Action-Test - [WithFGPAT] - runs-on: ubuntu-latest - 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: - Token: ${{ secrets.TEST_FG_PAT }} - Script: | - LogGroup 'Get-GitHubUser' { - Get-GitHubUser | Format-Table -AutoSize - } - - ActionTestWithGitHubApp: - name: Action-Test - [GitHubApp] - runs-on: ubuntu-latest steps: # Need to check out as part of the test, as its a local action - name: Checkout repo @@ -135,21 +28,132 @@ jobs: - name: Action-Test uses: ./ with: - ClientID: ${{ secrets.TEST_APP_CLIENT_ID }} - PrivateKey: ${{ secrets.TEST_APP_PRIVATE_KEY }} - Script: | - LogGroup 'Get-GitHubApp' { - Get-GitHubApp | Format-Table -AutoSize - } - - LogGroup 'Get-GitHubAppInstallation' { - Get-GitHubAppInstallation | Format-Table -AutoSize - } - - LogGroup 'Do something as an installation' { - Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object { - Connect-GitHub -Token $_.token -Silent - Get-GitHubContext | Format-Table -AutoSize - Get-GitHubGitConfig | Format-Table -AutoSize - } - } + Debug: true + Verbose: true + + + # ActionTestWithScript: + # name: Action-Test - [WithScript] + # runs-on: ubuntu-latest + # 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: + # Script: | + # LogGroup 'Get-GitHubZen' { + # Get-GitHubZen + # } + + # ActionTestCommands: + # name: Action-Test - [Commands] + # runs-on: ubuntu-latest + # 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: ./ + # id: test + # with: + # Prerelease: true + # Script: | + # $cat = Get-GitHubOctocat + # $zen = Get-GitHubZen + # Set-GitHubEnvironmentVariable -Name 'OCTOCAT' -Value $cat + # Set-GitHubOutput -Name 'WISECAT' -Value $cat + # Set-GitHubOutput -Name 'Zen' -Value $zen + + # - name: Run-test + # shell: pwsh + # env: + # result: ${{ steps.test.outputs.result }} + # run: | + # $result = $env:result | ConvertFrom-Json + # Set-GitHubStepSummary -Summary $result.WISECAT + # Write-GitHubNotice -Message $result.Zen -Title 'GitHub Zen' + + # ActionTestWithoutToken: + # name: Action-Test - [WithoutToken] + # runs-on: ubuntu-latest + # 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: + # Token: '' + # Script: | + # LogGroup 'My group' { + # 'This is a group' + # } + + # ActionTestWithPAT: + # name: Action-Test - [WithPAT] + # runs-on: ubuntu-latest + # 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: + # Token: ${{ secrets.TEST_PAT }} + # Script: | + # LogGroup 'Get-GitHubUser' { + # Get-GitHubUser | Format-Table -AutoSize + # } + + # ActionTestWithFGPAT: + # name: Action-Test - [WithFGPAT] + # runs-on: ubuntu-latest + # 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: + # Token: ${{ secrets.TEST_FG_PAT }} + # Script: | + # LogGroup 'Get-GitHubUser' { + # Get-GitHubUser | Format-Table -AutoSize + # } + + # ActionTestWithGitHubApp: + # name: Action-Test - [GitHubApp] + # runs-on: ubuntu-latest + # 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: + # ClientID: ${{ secrets.TEST_APP_CLIENT_ID }} + # PrivateKey: ${{ secrets.TEST_APP_PRIVATE_KEY }} + # Script: | + # LogGroup 'Get-GitHubApp' { + # Get-GitHubApp | Format-Table -AutoSize + # } + + # LogGroup 'Get-GitHubAppInstallation' { + # Get-GitHubAppInstallation | Format-Table -AutoSize + # } + + # LogGroup 'Do something as an installation' { + # Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object { + # Connect-GitHub -Token $_.token -Silent + # Get-GitHubContext | Format-Table -AutoSize + # Get-GitHubGitConfig | Format-Table -AutoSize + # } + # }