Skip to content

Commit eec3b84

Browse files
Use GitHub App token in publish workflow
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b5cbfe3 commit eec3b84

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/Publish-Module.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
APIKey:
77
description: The API key for the PowerShell Gallery.
88
required: true
9+
GitHubAppClientId:
10+
description: The client ID of the GitHub App used for repository API calls.
11+
required: true
12+
GitHubAppPrivateKey:
13+
description: The private key of the GitHub App used for repository API calls.
14+
required: true
915
inputs:
1016
Settings:
1117
type: string
@@ -37,11 +43,19 @@ jobs:
3743
path: _wf
3844
persist-credentials: false
3945

46+
- name: Create GitHub App token
47+
id: App-Token
48+
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
49+
with:
50+
app-id: ${{ secrets.GitHubAppClientId }}
51+
private-key: ${{ secrets.GitHubAppPrivateKey }}
52+
4053
- name: Publish module
4154
if: fromJson(inputs.Settings).Publish.Module.Resolution.ReleaseType != 'None'
4255
uses: ./_wf/.github/actions/Publish-PSModule
4356
env:
44-
GH_TOKEN: ${{ github.token }}
57+
GH_TOKEN: ${{ steps.App-Token.outputs.token }}
58+
GITHUB_TOKEN: ${{ steps.App-Token.outputs.token }}
4559
with:
4660
Name: ${{ fromJson(inputs.Settings).Name }}
4761
ModulePath: outputs/module
@@ -56,7 +70,8 @@ jobs:
5670
if: fromJson(inputs.Settings).Publish.Module.Resolution.ReleaseType != 'Prerelease'
5771
uses: ./_wf/.github/actions/Cleanup-PSModulePrereleases
5872
env:
59-
GH_TOKEN: ${{ github.token }}
73+
GH_TOKEN: ${{ steps.App-Token.outputs.token }}
74+
GITHUB_TOKEN: ${{ steps.App-Token.outputs.token }}
6075
with:
6176
WhatIf: ${{ github.repository == 'PSModule/Process-PSModule' }}
6277
AutoCleanup: ${{ fromJson(inputs.Settings).Publish.Module.AutoCleanup }}

0 commit comments

Comments
 (0)