-
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (46 loc) · 1.96 KB
/
update-prs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Refresh PRs
on:
push:
branches:
- main
permissions:
pull-requests: write
jobs:
trigger-pr-update:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
// Get a list of all issues created by the PR opener
// See: https://octokit.github.io/rest.js/#pagination
const creator = context.payload.sender.login
const prs = await github.request('GET /repos/{owner}/{repo}/pulls', {
owner: context.repo.owner,
repo: context.repo.repo,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
for (const pr of prs.data) {
if (pr.state !== 'open') continue;
console.log("Refreshing PR diff for #" + pr.number + " (" + pr.title + ")");
await github.request('PATCH /repos/{owner}/{repo}/pulls/{pull_number}', {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
base: 'develop',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
await github.request('PATCH /repos/{owner}/{repo}/pulls/{pull_number}', {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
base: 'main',
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
}