@@ -3,6 +3,10 @@ name: 'Josh Subtree Sync'
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
+ github-app-id :
7
+ description : ' ID of a GitHub app that will create the sync PR'
8
+ required : true
9
+ type : string
6
10
branch-name :
7
11
description : ' Name of the branch to create for the sync'
8
12
required : false
27
31
required : false
28
32
type : string
29
33
secrets :
30
- token :
31
- description : ' GITHUB_TOKEN from the caller workflow '
34
+ github-app-secret :
35
+ description : ' Secret for a GitHub app that will create the sync PR '
32
36
required : true
33
37
zulip-api-token :
34
38
description : ' Zulip API token for authentication'
81
85
82
86
exit ${exitcode}
83
87
88
+ - uses : actions/create-github-app-token@v2
89
+ id : app-token
90
+ with :
91
+ app-id : ${{ inputs.github-app-id }}
92
+ private-key : ${{ secrets.github-app-secret }}
93
+
84
94
- name : Push changes to a branch
85
95
if : ${{ steps.josh-sync.outputs.pull_result == 'pull-finished' }}
86
96
run : |
92
102
id : update-pr
93
103
if : ${{ steps.josh-sync.outputs.pull_result == 'pull-finished' }}
94
104
env :
95
- GITHUB_TOKEN : ${{ secrets .token }}
105
+ GITHUB_TOKEN : ${{ steps.app-token.outputs .token }}
96
106
run : |
97
107
# Check if an open pull request already exists
98
108
RESULT=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | length' --json title`
@@ -114,10 +124,16 @@ jobs:
114
124
steps :
115
125
- uses : actions/checkout@v4
116
126
127
+ - uses : actions/create-github-app-token@v2
128
+ id : app-token
129
+ with :
130
+ app-id : ${{ inputs.github-app-id }}
131
+ private-key : ${{ secrets.github-app-secret }}
132
+
117
133
- name : Compute message
118
134
id : create-message
119
135
env :
120
- GITHUB_TOKEN : ${{ secrets .token }}
136
+ GITHUB_TOKEN : ${{ steps.app-token.outputs .token }}
121
137
run : |
122
138
if [ "${{ needs.perform-pull.result }}" == "failure" ]; then
123
139
WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
0 commit comments