File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ name : Update PRs
3+
4+ on :
5+ push :
6+ workflow_dispatch :
7+
8+ permissions :
9+ pull-requests : write
10+ contents : write
11+
12+ jobs :
13+ update :
14+ if : startsWith(github.ref, 'refs/heads/')
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Update Pull Requests
18+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
19+ with :
20+ script : |
21+ const opts = github.rest.pulls.list.endpoint.merge({
22+ owner: context.repo.owner,
23+ repo: context.repo.repo,
24+ state: 'open',
25+ base: context.ref.replace('refs/heads/', ''),
26+ })
27+ const prs = await github.paginate(opts)
28+ for (const pr of prs) {
29+ core.info(`Updating PR #${pr.number}`)
30+ github.rest.pulls.updateBranch({
31+ owner: context.repo.owner,
32+ repo: context.repo.repo,
33+ pull_number: pr.number,
34+ }).then(function(result) {
35+ core.info(JSON.stringify(result.data))
36+ }).catch(function(error) {
37+ core.error(error)
38+ })
39+ }
You can’t perform that action at this time.
0 commit comments