@rmartz/bot-automerge 0.2.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -46
- package/dist/bin/bot-automerge.js +1 -4
- package/dist/index.d.ts +8 -4
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -11,69 +11,46 @@ merge?", bot-automerge answers "is this a bot PR we trust enough to enable
|
|
|
11
11
|
auto-merge on?". Unlike merge-safety, it posts **no check-run**.
|
|
12
12
|
|
|
13
13
|
It is distributed the same way [`@rmartz/repo-hygiene`](https://github.com/rmartz/repo-hygiene)
|
|
14
|
-
and `@rmartz/merge-safety` are
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
and `@rmartz/merge-safety` are — the package lives here, and consumers reach it
|
|
15
|
+
through a separate action repo:
|
|
16
|
+
|
|
17
|
+
1. **Updates propagate automatically.** Consuming repos pin
|
|
18
|
+
[`rmartz/bot-automerge-action`](https://github.com/rmartz/bot-automerge-action)
|
|
19
|
+
by SHA; Dependabot's `github-actions` ecosystem opens PRs to bump that pin. The
|
|
20
|
+
action pins this package's version in its own `package.json`, bumped by
|
|
21
|
+
Dependabot's `npm` ecosystem, so a new CLI release reaches consumers as an
|
|
22
|
+
action release.
|
|
18
23
|
2. **No check-run contract.** bot-automerge is purely an eligibility enabler — it
|
|
19
24
|
requires no fleet-wide status-check name. See
|
|
20
25
|
[docs/bot-automerge-contract.md](docs/bot-automerge-contract.md).
|
|
21
26
|
|
|
22
27
|
> **Status: implemented.** The `enable` classification — Dependabot `patch`/`minor`
|
|
23
|
-
> bumps and release-please release PRs —
|
|
24
|
-
>
|
|
28
|
+
> bumps and release-please release PRs — shipped in `v0.1.0`, the first release to
|
|
29
|
+
> GitHub Packages. It was built per
|
|
25
30
|
> [ai-tools#264](https://github.com/rmartz/ai-tools/issues/264); see
|
|
26
31
|
> [docs/bot-automerge-contract.md](docs/bot-automerge-contract.md) for the
|
|
27
32
|
> eligibility contract.
|
|
28
33
|
|
|
29
34
|
## Using it in a consuming repo
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```yaml
|
|
37
|
-
# .github/workflows/bot-automerge.yml
|
|
38
|
-
name: bot-automerge
|
|
39
|
-
on:
|
|
40
|
-
pull_request_target:
|
|
41
|
-
types: [opened, reopened, synchronize, labeled]
|
|
42
|
-
permissions:
|
|
43
|
-
contents: write
|
|
44
|
-
pull-requests: write
|
|
45
|
-
packages: read # install the CLI from GitHub Packages
|
|
46
|
-
jobs:
|
|
47
|
-
bot-automerge:
|
|
48
|
-
uses: rmartz/bot-automerge/.github/workflows/bot-automerge.yml@<sha> # vX.Y.Z
|
|
49
|
-
with:
|
|
50
|
-
pr: ${{ github.event.pull_request.number }}
|
|
51
|
-
secrets: inherit
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
It uses `pull_request_target` (not `pull_request`) because Dependabot PRs run with
|
|
55
|
-
a read-only token, and enabling auto-merge needs base-context write.
|
|
36
|
+
Use [`rmartz/bot-automerge-action`](https://github.com/rmartz/bot-automerge-action)
|
|
37
|
+
— its [consumer guide](https://github.com/rmartz/bot-automerge-action/blob/main/docs/consuming.md)
|
|
38
|
+
has the caller workflow, its permissions, and the `merge-safety` prerequisite.
|
|
39
|
+
This repo no longer ships a reusable workflow; see
|
|
40
|
+
[docs/consuming.md](docs/consuming.md) for what that means for existing callers.
|
|
56
41
|
|
|
57
42
|
> **Require `merge-safety` + your CI checks on the default branch _before_ adopting
|
|
58
|
-
>
|
|
43
|
+
> it.** `gh pr merge --auto` merges a PR immediately if the repo has no required
|
|
59
44
|
> status checks — bot-automerge only makes a bot PR _eligible_ to auto-merge; the
|
|
60
|
-
> repo's required checks are what it waits on.
|
|
61
|
-
> [consumer setup guide](docs/consuming.md) for the full prerequisite.
|
|
62
|
-
|
|
63
|
-
The public `@rmartz/bot-automerge` package on GitHub Packages is readable with the
|
|
64
|
-
built-in `GITHUB_TOKEN`, so no consumer PAT is required.
|
|
65
|
-
|
|
66
|
-
> For the full walkthrough — the caller's permissions, why it isn't trigger-free,
|
|
67
|
-
> and how the pin stays current — see the
|
|
68
|
-
> [consumer setup guide](docs/consuming.md).
|
|
45
|
+
> repo's required checks are what it waits on.
|
|
69
46
|
|
|
70
47
|
## Requirements
|
|
71
48
|
|
|
72
49
|
- Node.js >= 20.11
|
|
73
50
|
- pnpm 9 (pinned via `packageManager`)
|
|
74
51
|
|
|
75
|
-
Consuming repos need neither —
|
|
76
|
-
GitHub-hosted runner.
|
|
52
|
+
Consuming repos need neither — `rmartz/bot-automerge-action` runs the published
|
|
53
|
+
CLI on a GitHub-hosted runner.
|
|
77
54
|
|
|
78
55
|
## Local development
|
|
79
56
|
|
|
@@ -90,10 +67,16 @@ pnpm run test # vitest
|
|
|
90
67
|
|
|
91
68
|
Versioned by [semantic-release](.releaserc.json). A push to `main` analyzes the
|
|
92
69
|
Conventional-Commit history since the last `bot-automerge-v*` tag and, when a
|
|
93
|
-
release is warranted, publishes the package to
|
|
94
|
-
|
|
70
|
+
release is warranted, publishes the package to npmjs (public, via OIDC trusted
|
|
71
|
+
publishing with provenance — no npm token) and creates the git tag + GitHub
|
|
72
|
+
Release. Versions up to 0.2.1 were published to GitHub Packages and stay there for
|
|
73
|
+
existing pins; new versions go to npmjs only. There is no release PR and no
|
|
74
|
+
commit-back, so the
|
|
95
75
|
built-in `GITHUB_TOKEN` suffices. `tagFormat` stays `bot-automerge-v${version}`
|
|
96
|
-
for continuity with the prior release-please tags.
|
|
76
|
+
for continuity with the prior release-please tags. A `Release dry-run` CI job
|
|
77
|
+
validates the semantic-release config (that the changelog toolchain renders) on
|
|
78
|
+
every PR, so a broken release setup is caught before merge rather than on the
|
|
79
|
+
post-merge release run.
|
|
97
80
|
|
|
98
81
|
---
|
|
99
82
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AUTOMERGE_HANDLED_LABEL,
|
|
4
4
|
RELEASE_PLEASE_BRANCH_PREFIX,
|
|
5
|
-
RELEASE_PLEASE_PENDING_LABEL,
|
|
6
5
|
isBotAutomergeCommand,
|
|
7
6
|
isDependabotAuthor,
|
|
8
7
|
isDependabotUpdateType,
|
|
@@ -143,9 +142,7 @@ function isEvaluablePrState(state) {
|
|
|
143
142
|
}
|
|
144
143
|
function detectBotPrType(view) {
|
|
145
144
|
if (isDependabotAuthor(view.author)) return "dependabot";
|
|
146
|
-
if (view.headRefName.startsWith(RELEASE_PLEASE_BRANCH_PREFIX)
|
|
147
|
-
return "release-please";
|
|
148
|
-
}
|
|
145
|
+
if (view.headRefName.startsWith(RELEASE_PLEASE_BRANCH_PREFIX)) return "release-please";
|
|
149
146
|
return null;
|
|
150
147
|
}
|
|
151
148
|
function semverWord(updateType) {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* The classification + enablement implementation (and the `ai-bot-automerge` bin)
|
|
11
11
|
* lives alongside it; this module is intentionally the narrow, frozen surface the
|
|
12
|
-
*
|
|
12
|
+
* bot-automerge-action and consumers depend on. Extracted per rmartz/ai-tools#264.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
15
|
* The operations the `ai-bot-automerge` CLI dispatches:
|
|
@@ -45,11 +45,15 @@ declare const DEPENDABOT_AUTHORS: readonly ["dependabot[bot]", "app/dependabot"]
|
|
|
45
45
|
declare function isDependabotAuthor(login: string): boolean;
|
|
46
46
|
/**
|
|
47
47
|
* The head-branch prefix release-please gives its release PR (e.g.
|
|
48
|
-
* `release-please--branches--main`).
|
|
49
|
-
*
|
|
48
|
+
* `release-please--branches--main`). This prefix alone marks a PR as a
|
|
49
|
+
* release-please release PR.
|
|
50
50
|
*/
|
|
51
51
|
declare const RELEASE_PLEASE_BRANCH_PREFIX = "release-please--";
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* The label release-please applies to its open release PR. Informational only:
|
|
54
|
+
* it is NOT an eligibility signal, because anyone with triage permission can
|
|
55
|
+
* apply it to any PR (GHSA-4f7f-7fcp-gcm6).
|
|
56
|
+
*/
|
|
53
57
|
declare const RELEASE_PLEASE_PENDING_LABEL = "autorelease: pending";
|
|
54
58
|
/**
|
|
55
59
|
* The Dependabot semver update-type, as emitted verbatim by
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rmartz/bot-automerge",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Enables GitHub-native auto-merge for trustworthy bot pull requests (Dependabot patch/minor bumps and release-please release PRs), distributed via
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Enables GitHub-native auto-merge for trustworthy bot pull requests (Dependabot patch/minor bumps and release-please release PRs), distributed via rmartz/bot-automerge-action.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
7
7
|
"bot-automerge",
|
|
8
8
|
"auto-merge",
|
|
9
9
|
"github-actions",
|
|
10
|
-
"reusable-workflow",
|
|
11
10
|
"dependabot"
|
|
12
11
|
],
|
|
13
12
|
"homepage": "https://github.com/rmartz/bot-automerge#readme",
|
|
@@ -50,12 +49,12 @@
|
|
|
50
49
|
"test:watch": "vitest"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^26.6.
|
|
52
|
+
"@types/node": "^26.6.2",
|
|
54
53
|
"@typescript-eslint/eslint-plugin": "^8.70.0",
|
|
55
54
|
"@typescript-eslint/parser": "^8.70.0",
|
|
56
55
|
"@vitest/coverage-v8": "^5.0.1",
|
|
57
56
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
58
|
-
"eslint": "^10.
|
|
57
|
+
"eslint": "^10.11.0",
|
|
59
58
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
60
59
|
"eslint-plugin-import": "^2.32.0",
|
|
61
60
|
"prettier": "^3.9.6",
|