From 3285d0d7646532aa0b7460e08144713628704cba Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 10 Nov 2024 16:28:46 +0100 Subject: [PATCH 1/4] Add a test for FG PAT --- .github/workflows/Action-Test.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index ba233e2..d95d5e2 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -86,6 +86,26 @@ jobs: Get-GitHubContext } + LogGroup 'Get-GitHubUser' { + Get-GitHubUser + } + 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-GitHubContext' { + Get-GitHubContext + } + LogGroup 'Get-GitHubUser' { Get-GitHubUser } From d31459e70e1a120e00f646db79fef9ebf64f2188 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 10 Nov 2024 16:42:54 +0100 Subject: [PATCH 2/4] Add test for app tokens --- .github/workflows/Action-Test.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index d95d5e2..dc49e8a 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -89,6 +89,24 @@ jobs: LogGroup 'Get-GitHubUser' { Get-GitHubUser } + + LogGroup 'Get-GitHubViewer' { + $query = @" + query { + viewer { + login + id + databaseId + } + } + "@ + + $results = Invoke-GitHubGraphQLQuery -Query $query + $results + $results.data + $results.data.viewer + } + ActionTestWithFGPAT: name: Action-Test - [WithFGPAT] runs-on: ubuntu-latest @@ -110,6 +128,23 @@ jobs: Get-GitHubUser } + LogGroup 'Get-GitHubViewer' { + $query = @" + query { + viewer { + login + id + databaseId + } + } + "@ + + $results = Invoke-GitHubGraphQLQuery -Query $query + $results + $results.data + $results.data.viewer + } + ActionTestWithGitHubApp: name: Action-Test - [GitHubApp] runs-on: ubuntu-latest @@ -135,3 +170,9 @@ jobs: LogGroup 'Get-GitHubAppInstallation' { Get-GitHubAppInstallation } + + LogGroup 'Do something as an installation' { + Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object { + Connect-GitHub -Token $_.token + } + } From ab061763470129343b25c9516829774e7113e049 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 10 Nov 2024 16:55:40 +0100 Subject: [PATCH 3/4] Test Viewer --- .github/workflows/Action-Test.yml | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index dc49e8a..b4a0bd4 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -48,6 +48,23 @@ jobs: Get-GitHubZen } + LogGroup 'Get-GitHubViewer' { + $query = @" + query { + viewer { + login + id + databaseId + } + } + "@ + + $results = Invoke-GitHubGraphQLQuery -Query $query + $results + $results.data + $results.data.viewer + } + ActionTestWithoutToken: name: Action-Test - [WithoutToken] runs-on: ubuntu-latest @@ -174,5 +191,22 @@ jobs: LogGroup 'Do something as an installation' { Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object { Connect-GitHub -Token $_.token + + LogGroup 'Get-GitHubViewer' { + $query = @" + query { + viewer { + login + id + databaseId + } + } + "@ + + $results = Invoke-GitHubGraphQLQuery -Query $query + $results + $results.data + $results.data.viewer + } } } From d7273ed13c60b0df72f43c80698842d4f62cf48e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 10 Nov 2024 17:46:06 +0100 Subject: [PATCH 4/4] Fix --- .github/workflows/Action-Test.yml | 68 ------------------------------- 1 file changed, 68 deletions(-) diff --git a/.github/workflows/Action-Test.yml b/.github/workflows/Action-Test.yml index b4a0bd4..da0eda3 100644 --- a/.github/workflows/Action-Test.yml +++ b/.github/workflows/Action-Test.yml @@ -48,23 +48,6 @@ jobs: Get-GitHubZen } - LogGroup 'Get-GitHubViewer' { - $query = @" - query { - viewer { - login - id - databaseId - } - } - "@ - - $results = Invoke-GitHubGraphQLQuery -Query $query - $results - $results.data - $results.data.viewer - } - ActionTestWithoutToken: name: Action-Test - [WithoutToken] runs-on: ubuntu-latest @@ -107,23 +90,6 @@ jobs: Get-GitHubUser } - LogGroup 'Get-GitHubViewer' { - $query = @" - query { - viewer { - login - id - databaseId - } - } - "@ - - $results = Invoke-GitHubGraphQLQuery -Query $query - $results - $results.data - $results.data.viewer - } - ActionTestWithFGPAT: name: Action-Test - [WithFGPAT] runs-on: ubuntu-latest @@ -145,23 +111,6 @@ jobs: Get-GitHubUser } - LogGroup 'Get-GitHubViewer' { - $query = @" - query { - viewer { - login - id - databaseId - } - } - "@ - - $results = Invoke-GitHubGraphQLQuery -Query $query - $results - $results.data - $results.data.viewer - } - ActionTestWithGitHubApp: name: Action-Test - [GitHubApp] runs-on: ubuntu-latest @@ -191,22 +140,5 @@ jobs: LogGroup 'Do something as an installation' { Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object { Connect-GitHub -Token $_.token - - LogGroup 'Get-GitHubViewer' { - $query = @" - query { - viewer { - login - id - databaseId - } - } - "@ - - $results = Invoke-GitHubGraphQLQuery -Query $query - $results - $results.data - $results.data.viewer - } } }