Skip to content

Automerge New CDN Files #11

Automerge New CDN Files

Automerge New CDN Files #11

Workflow file for this run

name: Automerge Batches
on:
schedule:
- cron: '*/5 * * * *' # Run every 5 minutes
jobs:
batch-merge:
runs-on: ubuntu-latest
steps:
- name: List Pull Requests Ready for Merge
id: pr_list
uses: actions/github-script@v6
with:
script: |
const { data: pullRequests } = await github.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'updated',
direction: 'desc',
});
const prNumbers = pullRequests
.filter(pr => pr.labels.some(label => label.name === 'automerge'))
.map(pr => pr.number);
if (prNumbers.length > 0) {
return prNumbers.join(',');
} else {
return '';
}
- name: Merge PRs
if: steps.pr_list.outputs.result != ''
uses: actions/github-script@v6
with:
script: |
const prNumbers = ${{ steps.pr_list.outputs.result }}.split(',');
for (const pr of prNumbers) {
await github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr,
merge_method: 'squash',
});
}