-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2f43f8
commit d905cec
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
name: Update PRs | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
update: | ||
if: startsWith(github.ref, 'refs/heads/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update Pull Requests | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: | | ||
const opts = github.rest.pulls.list.endpoint.merge({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
base: context.ref.replace('refs/heads/', ''), | ||
}) | ||
const prs = await github.paginate(opts) | ||
for (const pr of prs) { | ||
core.info(`Updating PR #${pr.number}`) | ||
github.rest.pulls.updateBranch({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pr.number, | ||
}).then(function(result) { | ||
core.info(JSON.stringify(result.data)) | ||
}).catch(function(error) { | ||
core.error(error) | ||
}) | ||
} |