Skip to content

Commit ff98f29

Browse files
committed
fix: authenticate upstream refresh with GitHub App
1 parent 9f7465b commit ff98f29

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

‎.github/workflows/refresh-upstream.yml‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,32 @@ jobs:
2020
contents: write
2121
pull-requests: write
2222
steps:
23+
- name: Validate GitHub App configuration
24+
env:
25+
WORKFLOW_APP_ID: ${{ vars.LIBRECODE_WORKFLOW_APP_ID }}
26+
WORKFLOW_APP_PRIVATE_KEY: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
27+
run: |
28+
if [ -z "$WORKFLOW_APP_ID" ]; then
29+
echo "::error::LIBRECODE_WORKFLOW_APP_ID is not configured."
30+
exit 1
31+
fi
32+
if [ -z "$WORKFLOW_APP_PRIVATE_KEY" ]; then
33+
echo "::error::LIBRECODE_WORKFLOW_APP_PRIVATE_KEY is not configured."
34+
exit 1
35+
fi
36+
37+
- name: Create GitHub App token
38+
id: app-token
39+
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
40+
with:
41+
app-id: ${{ vars.LIBRECODE_WORKFLOW_APP_ID }}
42+
private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
43+
owner: LibreCodeCoop
44+
repositories: github-workflows
45+
permission-contents: write
46+
permission-pull-requests: write
47+
permission-workflows: write
48+
2349
- name: Checkout
2450
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2551
with:
@@ -57,7 +83,7 @@ jobs:
5783
if: steps.refresh.outcome == 'success'
5884
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
5985
with:
60-
token: ${{ secrets.WORKFLOW_UPDATE_TOKEN }}
86+
token: ${{ steps.app-token.outputs.token }}
6187
commit-message: 'chore: refresh upstream workflow pins'
6288
committer: GitHub <noreply@github.com>
6389
author: github-workflows bot <noreply@github.com>
@@ -72,6 +98,7 @@ jobs:
7298
upstream/sources.json
7399
upstream/vendor/**
74100
workflow-templates/**
101+
.github/workflows/**
75102
76103
- name: Fail when patches need manual updates
77104
if: steps.render.outcome == 'failure'

0 commit comments

Comments
 (0)