mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-24 00:16:36 +00:00
42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
name: Update PR Branches
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
name: Update
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Update branches
|
|
uses: actions/github-script@v8
|
|
with:
|
|
github-token: ${{ secrets.BOT }}
|
|
script: |
|
|
const prs = await github.paginate(
|
|
github.rest.pulls.list,
|
|
{
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: "open",
|
|
per_page: 100
|
|
}
|
|
);
|
|
|
|
console.log(`Found ${prs.length} open PRs`);
|
|
|
|
for (const pr of prs) {
|
|
try {
|
|
await github.rest.pulls.updateBranch({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: pr.number
|
|
});
|
|
|
|
console.log(`Updated #${pr.number} (${pr.head.ref})`);
|
|
} catch (error) {
|
|
console.log(`Could not update #${pr.number}: ${error.message}`);
|
|
}
|
|
}
|