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
15 changes: 15 additions & 0 deletions .github/workflows/auto-dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Auto-approve Dependabot PRs

on:
pull_request:
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow triggers on all pull_request events but only processes Dependabot PRs. Consider using pull_request_target event with type filters like [opened, synchronize, reopened] to better control when this workflow runs, or add types to the pull_request trigger to avoid unnecessary workflow executions.

Suggested change
pull_request:
pull_request:
types: [opened, synchronize, reopened]

Copilot uses AI. Check for mistakes.

jobs:
auto-approve:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Auto-approve and merge Dependabot PRs
Comment on lines +10 to +11
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using secrets.GITHUB_TOKEN with auto-merge for Dependabot PRs bypasses code review and CI checks. Consider adding conditions to verify that CI checks have passed before auto-merging, or restrict auto-merge to patch/minor updates only to reduce risk of breaking changes being merged automatically.

Suggested change
steps:
- name: Auto-approve and merge Dependabot PRs
steps:
- name: Wait for required status checks
uses: actions/github-script@v6
id: check-status
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const sha = pr.data.head.sha;
const checks = await github.rest.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: sha,
});
const failed = checks.data.check_runs.filter(
c => c.status === "completed" && c.conclusion !== "success"
);
if (failed.length > 0) {
core.setFailed("Some required status checks have not passed.");
}
- name: Auto-approve and merge Dependabot PRs
if: steps.check-status.outcome == 'success'

Copilot uses AI. Check for mistakes.
uses: frequenz-floss/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
merge-method: merge