Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dependabot auto-merge
name: Dependency bot auto-merge

on:
workflow_run:
Expand All @@ -15,14 +15,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Enable auto-merge for current Dependabot PRs
- name: Enable auto-merge for current dependency bot PRs
uses: actions/github-script@v9
env:
GH_TOKEN: ${{ github.token }}
with:
script: |
const { owner, repo } = context.repo;
const candidates = context.payload.workflow_run.pull_requests ?? [];
const allowedBots = new Set([
"dependabot[bot]",
"pre-commit-ci[bot]",
]);

for (const candidate of candidates) {
const { data: pullRequest } = await github.rest.pulls.get({
Expand All @@ -31,8 +35,8 @@ jobs:
pull_number: candidate.number,
});

if (pullRequest.user.login !== "dependabot[bot]") {
core.info(`Skipping PR #${pullRequest.number}: not opened by Dependabot.`);
if (!allowedBots.has(pullRequest.user.login)) {
core.info(`Skipping PR #${pullRequest.number}: not opened by an allowed dependency bot.`);
continue;
}

Expand Down