Repository navigation
feat(dependabot-reusable): add per-type approve and merge inputs - #167
Merged
Merged
Conversation
Add 6 optional inputs: autoapprove-production, automerge-production, autoapprove-development, automerge-development, autoapprove-indirect, and automerge-indirect. Each one is a comma-separated list of major, minor, patch, and security (or none). When a list is set, it replaces the autoapprove-* or automerge-* booleans for PRs of that dependency type, so 1 call (1 job, 1 runner) can apply different rules to each dependency type. Before, each set of rules needed its own call and its own job. Empty lists (the default) keep the old behavior, so existing callers do not change. The security alert lookup also runs when a list includes security. Bad list values fail the decide step with a clear summary message. Add 12 tests for the new inputs, and update the README and the workflow comments to show the 1-call pattern. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Let 1 call of the reusable Dependabot workflow apply different approve and merge rules to each dependency type. Before this change, a caller that wanted different rules for production, development, and indirect dependencies had to call the workflow 3 times. Each call is its own job, so every Dependabot event started 3 runners. With the new inputs, the same rules need 1 call, 1 job, and 1 runner.
Changes
Workflow inputs
6 new optional string inputs:
autoapprove-production,automerge-production,autoapprove-development,automerge-development,autoapprove-indirect, andautomerge-indirect.Each one is a comma-separated list of
major,minor,patch, andsecurity, ornone. Spaces are ignored.When a list is set, it replaces the
autoapprove-*orautomerge-*booleans for PRs of that dependency type. When a list is empty (the default), the booleans apply, as before.Decide step
Validates all 6 lists. A bad value fails the step and names the input and the value in the job summary.
Picks the list for the PR's dependency type, and checks the update level and
securityagainst it.The job summary says which input made each decision, for example "
autoapprove-indirectincludesminor" or "automerge-indirect(patch) does not includeminor".Security alert lookup
security(it still needs thetokensecret).Docs
README: 6 new rows in the inputs table, and the "Different rules for each dependency type" section now shows the 1-call pattern.
Workflow comments: the same 1-call example. The multi-call pattern with
dependency-typesis still described, because it still works.Tests
tests/dependabot-reusable/run_tests.py.Behavior notes
No input is removed or renamed, and the new inputs are optional, so existing callers work as before. The existing tests run without the new inputs, which is how an existing caller behaves, and they all pass.
dependency-typesstill filters first. A per-type list cannot approve a dependency type thatdependency-typesexcludes.A list for one dependency type does not affect PRs of another type.
A list without
securityturns off the security rule for that type, even ifautoapprove-securityorautomerge-securityistrue.noneis a set list with no levels, so it turns off approve or merge for that type even when the booleans aretrue.The only text change for existing callers is a comma in 1 summary sentence for security updates ("This is a security update, and ...").
Example
Test plan
actionlint(withshellcheck) passes on the workflow.Prettier passes on all changed files.
The local test suite passes: 108 tests, 0 failed.
A caller that uses the new inputs passes
actionlintagainst this version of the workflow. The same check rejects a misspelled input name.The "Test Dependabot workflow" CI check passes on this PR.
After the merge, a caller with 1 call shows 1 job for a Dependabot PR.