一键导入
merge-dependabot-prs
Analyze and merge open Dependabot pull requests with testing and user confirmation before committing
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze and merge open Dependabot pull requests with testing and user confirmation before committing
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | merge-dependabot-prs |
| description | Analyze and merge open Dependabot pull requests with testing and user confirmation before committing |
Analyze and integrate open Dependabot pull requests into the codebase with proper testing and user confirmation before committing.
List all open Dependabot pull requests:
gh pr list --state open --author "app/dependabot" --json number,title,headRefName,updatedAt
If no PRs are found, also check for any PRs with "dependabot" in the branch name:
gh pr list --state open --json number,title,headRefName,author
Group the PRs by type:
go.mod/go.sum filespackage.json/package-lock.json files.github/workflows/ filesDetect monorepo patterns:
github.com/anchore/syft)bump <package> from X.Y.Z to A.B.C in /module-nameNote on tidy failures:
tidy: FAILURE in CI checksFor each PR, analyze:
Check PR status and mergability:
gh pr view <PR_NUMBER> --json mergeable,mergeStateStatus,statusCheckRollup
Review the changes:
gh pr diff <PR_NUMBER>
Check for breaking changes:
Check for conflicts:
Choose the appropriate strategy based on the PR pattern:
For mergeable PRs without conflicts that update only one module:
gh pr merge <PR_NUMBER> --merge --delete-branch
When multiple PRs update the same dependency across different modules:
This is the preferred approach for monorepos to avoid conflicts and tidy failures.
Identify the target version from any of the PRs (e.g., v1.42.3)
Update all affected modules manually:
# For each module that needs the update:
cd scanner-core && go get <package>@<version> && go mod tidy && cd ..
cd k8s-scan-server && go get <package>@<version> && go mod tidy && cd ..
cd pod-scanner && go get <package>@<version> && go mod tidy && cd ..
cd bjorn2scan-agent && go get <package>@<version> && go mod tidy && cd ..
Close all related Dependabot PRs with a comment:
gh pr close <PR_NUMBER> --comment "Closed in favor of manual update across all modules to maintain consistency. Updated in commit <commit-hash>."
Why this approach?
For PRs with conflicts or requiring code changes:
After merging or making manual changes, run the full test suite:
Build all components:
make build-all
Run tests for each module:
make -C k8s-scan-server test
make -C pod-scanner test
make -C k8s-update-controller test
make -C bjorn2scan-agent test
For scanner-core (note: integration tests may be slow due to Grype DB):
cd scanner-core && go test -v -short ./...
If tests fail after dependency updates:
Identify the breaking change by reviewing:
Make necessary code changes:
Re-run tests to verify fixes
If any code changes were made (not just dependency updates), run linters before committing:
Go modules - run golangci-lint from within each module directory:
cd k8s-scan-server && golangci-lint run ./...
cd pod-scanner && golangci-lint run ./...
cd k8s-update-controller && golangci-lint run ./...
cd bjorn2scan-agent && golangci-lint run ./...
cd scanner-core && golangci-lint run ./...
NPM/Web - run web linting:
cd scanner-core/web && npm run lint
Fix any linting errors before proceeding to commit.
IMPORTANT: Always ask the user before committing any changes.
Present a clear summary:
syft 1.42.2 → 1.42.3)Ask: "Would you like me to commit these changes?"
If approved, commit with an appropriate message:
For manual monorepo updates:
git add go.mod go.sum */go.mod */go.sum
git commit -m "chore(deps): bump <package> from X.Y.Z to A.B.C
Updated across all modules: scanner-core, k8s-scan-server, pod-scanner, bjorn2scan-agent
Also updated <N> transitive dependencies including:
- <notable-dep-1>
- <notable-dep-2>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
For individual PR merges:
# No manual commit needed - PR merge commits automatically
For manual updates with code changes:
git add <all-affected-files>
git commit -m "chore(deps): bump <package> from X.Y.Z to A.B.C
- Updated code to accommodate breaking changes
- <Brief description of code changes>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
Each commit pushed to main and each gh pr merge triggers a fresh CI run.
When you process multiple Dependabot PRs back-to-back (Strategy B commit + several
Strategy A merges), GitHub will queue a full CI pipeline for every single one —
even though the latest commit already contains all prior changes.
After the last merge, list in-flight runs and cancel everything except the latest commit's:
# See what's running
gh run list --limit 15 --json databaseId,status,headSha,name,displayTitle \
| jq -r '.[] | select(.status == "queued" or .status == "in_progress")
| "\(.databaseId)\t\(.headSha[0:7])\t\(.name)\t\(.displayTitle[0:55])"'
# Cancel each redundant run by ID
gh run cancel <run-id>
Rule of thumb: keep only the runs whose headSha matches git rev-parse HEAD
on origin/main. Earlier-commit runs are superseded — their outcome is already
captured by the latest run, which exercises the cumulative state.
Even better: bake this into the workflows so future pushes auto-cancel.
Add a concurrency block to each long-running workflow:
concurrency:
group: <workflow-name>-${{ github.ref }}
cancel-in-progress: true
Confirmed working in ci.yaml, agent-integration-test.yaml, and
auto-update-test.yaml (added 2026-05-11). Once those are in place you generally
won't need to cancel by hand — pushing the next commit handles it.
Also verify path filters are tight: a paths: ['scanner-core/**'] filter will
match scanner-core/web/** and trigger Go CI on web-only NPM updates. Use
!scanner-core/web/** exclusions inside paths, not paths-ignore (GitHub
silently drops paths-ignore when paths is present in the same event block).
Tidy failures in CI (EXPECTED in monorepos):
tidy: FAILURE in CI checksPR not mergeable due to other CI failures:
gh pr checks <PR_NUMBER>Multiple PRs for same dependency (monorepo pattern):
github.com/anchore/syft in different modulesConflicting PRs (different dependencies):
@dependabot rebase comment to rebase remaining PRs after each mergeBreaking API changes:
rg "package\.Function"When you find Dependabot PRs, follow this decision process:
Example from this codebase:
syft 1.42.2 → 1.42.3 across scanner-core, k8s-scan-server, pod-scanner, bjorn2scan-agentgo get github.com/anchore/syft@v1.42.3 && go mod tidy in each module