Skip to content

Commit 571871d

Browse files
authored
Merge pull request #9 from gitgitgadget/vet-github-actions
Use the official GitHub Action to obtain installation access tokens
2 parents 53fc07d + b391128 commit 571871d

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

.github/workflows/sync-git-gui.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
id: check
2626
with:
2727
script: |
28+
const [targetRepoOwner, targetRepoName] = process.env.TARGET_REPOSITORY.split('/')
29+
core.setOutput('target-repo-owner', targetRepoOwner)
30+
core.setOutput('target-repo-name', targetRepoName)
31+
2832
const sleep = async (milliseconds) => {
2933
return new Promise(resolve => setTimeout(resolve, milliseconds))
3034
}
@@ -109,12 +113,13 @@ jobs:
109113
core.setOutput('to-fetch', [...toFetch].join(' '))
110114
- name: obtain installation token
111115
if: steps.check.outputs.refspec != ''
112-
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
116+
uses: actions/create-github-app-token@v1
113117
id: token
114118
with:
115-
app_id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
116-
private_key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
117-
repository: ${{ env.TARGET_REPOSITORY }}
119+
app-id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
120+
private-key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
121+
owner: ${{ steps.check.outputs.target-repo-owner }}
122+
repositories: ${{ steps.check.outputs.target-repo-name }}
118123
- name: set authorization header
119124
if: steps.check.outputs.refspec != ''
120125
uses: actions/github-script@v7

.github/workflows/sync-gitster-git.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
id: check
2525
with:
2626
script: |
27+
const [targetRepoOwner, targetRepoName] = process.env.TARGET_REPOSITORY.split('/')
28+
core.setOutput('target-repo-owner', targetRepoOwner)
29+
core.setOutput('target-repo-name', targetRepoName)
30+
2731
const sleep = async (milliseconds) => {
2832
return new Promise(resolve => setTimeout(resolve, milliseconds))
2933
}
@@ -95,12 +99,13 @@ jobs:
9599
core.setOutput('to-fetch', [...toFetch].join(' '))
96100
- name: obtain installation token
97101
if: steps.check.outputs.refspec != ''
98-
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
102+
uses: actions/create-github-app-token@v1
99103
id: token
100104
with:
101-
app_id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
102-
private_key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
103-
repository: ${{ env.TARGET_REPOSITORY }}
105+
app-id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
106+
private-key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
107+
owner: ${{ steps.check.outputs.target-repo-owner }}
108+
repositories: ${{ steps.check.outputs.target-repo-name }}
104109
- name: set authorization header
105110
if: steps.check.outputs.refspec != ''
106111
uses: actions/github-script@v7

.github/workflows/sync-ref.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
id: check
3131
with:
3232
script: |
33+
const [targetRepoOwner, targetRepoName] = process.env.TARGET_REPOSITORY.split('/')
34+
core.setOutput('target-repo-owner', targetRepoOwner)
35+
core.setOutput('target-repo-name', targetRepoName)
36+
3337
const getSHA = async (repository, ref) => {
3438
if (ref.startsWith('refs/heads/') || ref.startsWith('refs/tags/')) ref = ref.substring(4)
3539
else throw new Error(`Cannot handle ref '${ref}`)
@@ -60,12 +64,13 @@ jobs:
6064
core.setOutput('target-sha', targetSHA || '')
6165
- name: obtain installation token
6266
if: steps.check.outputs.skip == 'false'
63-
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
67+
uses: actions/create-github-app-token@v1
6468
id: token
6569
with:
66-
app_id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
67-
private_key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
68-
repository: ${{ env.TARGET_REPOSITORY }}
70+
app-id: ${{ secrets.GITGITGADGET_GITHUB_APP_ID }}
71+
private-key: ${{ secrets.GITGITGADGET_GITHUB_APP_PRIVATE_KEY }}
72+
owner: ${{ steps.check.outputs.target-repo-owner }}
73+
repositories: ${{ steps.check.outputs.target-repo-name }}
6974
- name: set authorization header
7075
if: steps.check.outputs.skip == 'false'
7176
uses: actions/github-script@v7

0 commit comments

Comments
 (0)