Skip to content

Commit 39d914e

Browse files
authored
chore: update generator to create PR from fork due to changes in permissions (googleapis#3526)
1 parent 5ce8cb4 commit 39d914e

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.github/workflows/update-apis.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ jobs:
77
update-apis:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
1110
- uses: actions/setup-node@v4
1211
with:
1312
node-version: 14
13+
- run: gh repo fork googleapis/google-api-nodejs-client --fork-name google-api-nodejs-client-autodisco --clone --remote
14+
env:
15+
GH_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
16+
- run: gh repo sync yoshi-code-bot/google-api-nodejs-client-autodisco --force
17+
env:
18+
GH_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
1419
- run: npm install
20+
working-directory: ./google-api-nodejs-client-autodisco
1521
- run: npm run update-disclaimers
22+
working-directory: ./google-api-nodejs-client-autodisco
1623
- run: npm run submit-prs
24+
working-directory: ./google-api-nodejs-client-autodisco
1725
env:
1826
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1927
CODE_BOT_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}

src/generator/synth.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,19 @@ export async function synth(options: SynthOptions = {}) {
5757
}
5858
// only set these while running in the GitHub Actions environment
5959
if (process.env.GITHUB_ACTIONS) {
60-
await execa('git', ['config', 'user.email', '[email protected]']);
61-
await execa('git', ['config', 'user.name', 'Yoshi Automation']);
60+
await execa('git', [
61+
'config',
62+
'--global',
63+
'user.email',
64+
65+
]);
66+
await execa('git', ['config', '--global', 'user.name', 'Yoshi Automation']);
67+
await execa('git', [
68+
'config',
69+
'--global',
70+
`url.https://${process.env.CODE_BOT_TOKEN}@github.com/.insteadOf`,
71+
'https://github.com/',
72+
]);
6273
}
6374
const dirs = files.filter(f => {
6475
return (
@@ -108,7 +119,9 @@ export async function synth(options: SynthOptions = {}) {
108119
url: 'https://api.github.com/repos/googleapis/google-api-nodejs-client/pulls',
109120
data: {
110121
title: `${prefix}: run the generator`,
111-
head: branch,
122+
owner: 'googleapis',
123+
repo: 'google-api-nodejs-client',
124+
head: `yoshi-code-bot:${branch}`,
112125
base: 'main',
113126
body: changelogs.join('\n\n').slice(0, 65000),
114127
},

0 commit comments

Comments
 (0)