Skip to content

Commit 2a43e3c

Browse files
🩹 [Patch]: Refactor GitHub Actions workflow to simplify token handling and add GitHub App tests
1 parent d341348 commit 2a43e3c

File tree

1 file changed

+54
-23
lines changed

1 file changed

+54
-23
lines changed

‎.github/workflows/TestWorkflow.yml‎

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,8 @@ jobs:
144144
Get-GitHubUser | Format-Table -AutoSize
145145
}
146146
147-
ActionTestWithFGPAT:
148-
strategy:
149-
matrix:
150-
include:
151-
- name: Action-Test - [WithUserFGPAT] - [${{ inputs.runs-on }}]
152-
Token: TEST_USER_USER_FG_PAT
153-
- name: Action-Test - [WithOrgFGPAT] - [${{ inputs.runs-on }}]
154-
Token: TEST_USER_ORG_FG_PAT
155-
name: ${{ matrix.name }}
147+
ActionTestWithUSERFGPAT:
148+
name: Action-Test - [WithUserFGPAT] - [${{ inputs.runs-on }}]
156149
runs-on: ${{ inputs.runs-on }}
157150
steps:
158151
# Need to check out as part of the test, as its a local action
@@ -162,23 +155,14 @@ jobs:
162155
- name: Action-Test
163156
uses: ./
164157
with:
165-
Token: ${{ secrets[matrix.Token] }}
158+
Token: ${{ secrets.TEST_USER_USER_FG_PAT }}
166159
Script: |
167160
LogGroup 'Get-GitHubUser' {
168161
Get-GitHubUser | Format-Table -AutoSize
169162
}
170163
171-
ActionTestWithGitHubApp:
172-
strategy:
173-
matrix:
174-
include:
175-
- name: Action-Test - [GitHubAppEnt] - [${{ inputs.runs-on }}]
176-
clientID: TEST_APP_ENT_CLIENT_ID
177-
privateKey: TEST_APP_ENT_PRIVATE_KEY
178-
- name: Action-Test - [GitHubAppOrg] - [${{ inputs.runs-on }}]
179-
clientID: TEST_APP_ORG_CLIENT_ID
180-
privateKey: TEST_APP_ORG_PRIVATE_KEY
181-
name: ${{ matrix.name }}
164+
ActionTestWithORGFGPAT:
165+
name: Action-Test - [WithOrgFGPAT] - [${{ inputs.runs-on }}]
182166
runs-on: ${{ inputs.runs-on }}
183167
steps:
184168
# Need to check out as part of the test, as its a local action
@@ -188,8 +172,55 @@ jobs:
188172
- name: Action-Test
189173
uses: ./
190174
with:
191-
ClientID: ${{ secrets[matrix.clientID] }}
192-
PrivateKey: ${{ secrets[matrix.privateKey] }}
175+
Token: ${{ secrets.TEST_USER_ORG_FG_PAT }}
176+
Script: |
177+
LogGroup 'Get-GitHubUser' {
178+
Get-GitHubUser | Format-Table -AutoSize
179+
}
180+
181+
ActionTestWithGitHubAppEnt:
182+
name: Action-Test - [GitHubAppEnt] - [${{ inputs.runs-on }}]
183+
runs-on: ${{ inputs.runs-on }}
184+
steps:
185+
# Need to check out as part of the test, as its a local action
186+
- name: Checkout repo
187+
uses: actions/checkout@v4
188+
189+
- name: Action-Test
190+
uses: ./
191+
with:
192+
ClientID: ${{ secrets.TEST_APP_ENT_CLIENT_ID }}
193+
PrivateKey: ${{ secrets.TEST_APP_ENT_PRIVATE_KEY }}
194+
Script: |
195+
LogGroup 'Get-GitHubApp' {
196+
Get-GitHubApp | Format-Table -AutoSize
197+
}
198+
199+
LogGroup 'Get-GitHubAppInstallation' {
200+
Get-GitHubAppInstallation | Format-Table -AutoSize
201+
}
202+
203+
LogGroup 'Do something as an installation' {
204+
Get-GithubAppInstallation | New-GitHubAppInstallationAccessToken | ForEach-Object {
205+
Connect-GitHub -Token $_.token -Silent
206+
Get-GitHubContext | Format-Table -AutoSize
207+
Get-GitHubGitConfig | Format-Table -AutoSize
208+
}
209+
}
210+
211+
ActionTestWithGitHubAppOrg:
212+
name: Action-Test - [GitHubAppOrg] - [${{ inputs.runs-on }}]
213+
runs-on: ${{ inputs.runs-on }}
214+
steps:
215+
# Need to check out as part of the test, as its a local action
216+
- name: Checkout repo
217+
uses: actions/checkout@v4
218+
219+
- name: Action-Test
220+
uses: ./
221+
with:
222+
ClientID: ${{ secrets.TEST_APP_ORG_CLIENT_ID }}
223+
PrivateKey: ${{ secrets.TEST_APP_ORG_PRIVATE_KEY }}
193224
Script: |
194225
LogGroup 'Get-GitHubApp' {
195226
Get-GitHubApp | Format-Table -AutoSize

0 commit comments

Comments
 (0)