repokeeper 0.4.3 → 0.4.5
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 +5 -1
- package/dist/platforms/github.js +34 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,11 @@ work:
|
|
|
78
78
|
pull requests.
|
|
79
79
|
- Optionally add a `RELEASE_PLEASE_TOKEN` secret (a fine-grained token with contents, pull requests
|
|
80
80
|
and issues write access). Without it the release pull request is opened with `GITHUB_TOKEN`, and
|
|
81
|
-
GitHub
|
|
81
|
+
GitHub holds its `pull_request` runs until someone approves them; the `release-pr-ci` job approves
|
|
82
|
+
them, so the pull request gets its checks and required checks in a ruleset can pass.
|
|
83
|
+
|
|
84
|
+
A repository with no release yet (manifest at `0.0.0`) gets `initial-version: 0.1.0`, so its first
|
|
85
|
+
release is 0.1.0 rather than release-please's default 1.0.0.
|
|
82
86
|
|
|
83
87
|
Set `modules.drift: true` to add a `repokeeper` job to `ci.yml` that runs `repokeeper check` with
|
|
84
88
|
the version that wrote the standard, so a pull request that edits a managed file fails until the edit
|
package/dist/platforms/github.js
CHANGED
|
@@ -22,6 +22,15 @@ const workflowKey = (module, path, keyPath, value) => ({
|
|
|
22
22
|
value,
|
|
23
23
|
order: WORKFLOW_KEYS,
|
|
24
24
|
});
|
|
25
|
+
/** Waits briefly for the held runs to appear, since GitHub creates them just after the pull request event. */
|
|
26
|
+
const APPROVE_RELEASE_PR_RUNS = `for attempt in 1 2 3 4 5 6; do
|
|
27
|
+
ids=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs?branch=$BRANCH&event=pull_request&status=action_required" --jq '.workflow_runs[].id')
|
|
28
|
+
[ -n "$ids" ] && break
|
|
29
|
+
sleep 10
|
|
30
|
+
done
|
|
31
|
+
if [ -z "$ids" ]; then echo "::notice::no held runs for $BRANCH"; fi
|
|
32
|
+
for id in $ids; do gh api -X POST "repos/$GITHUB_REPOSITORY/actions/runs/$id/approve"; done
|
|
33
|
+
`;
|
|
25
34
|
const RELEASE_PLEASE_SCHEMA = "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json";
|
|
26
35
|
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
27
36
|
export const githubPlatform = {
|
|
@@ -146,6 +155,7 @@ export const githubPlatform = {
|
|
|
146
155
|
},
|
|
147
156
|
releaseAutomation(ctx, release) {
|
|
148
157
|
const path = ".github/workflows/release.yml";
|
|
158
|
+
const seed = release.version ?? ctx.repo.releasedVersion ?? "0.0.0";
|
|
149
159
|
return [
|
|
150
160
|
{
|
|
151
161
|
kind: "file",
|
|
@@ -163,6 +173,9 @@ export const githubPlatform = {
|
|
|
163
173
|
...(release.versionFile ? { "version-file": release.versionFile } : {}),
|
|
164
174
|
// Without it a pom at a release version first gets a pull request that only bumps to -SNAPSHOT
|
|
165
175
|
...(release.type === "maven" ? { "skip-snapshot": true } : {}),
|
|
176
|
+
// release-please makes a repository's first release 1.0.0 unless told otherwise; a release tag means
|
|
177
|
+
// there was one, even when a version file release-please never bumps still reads 0.0.0
|
|
178
|
+
...(seed === "0.0.0" && !ctx.repo.releasedVersion ? { "initial-version": "0.1.0" } : {}),
|
|
166
179
|
},
|
|
167
180
|
},
|
|
168
181
|
}),
|
|
@@ -171,7 +184,7 @@ export const githubPlatform = {
|
|
|
171
184
|
kind: "seed",
|
|
172
185
|
module: "release",
|
|
173
186
|
path: ".release-please-manifest.json",
|
|
174
|
-
content: json({ ".":
|
|
187
|
+
content: json({ ".": seed }),
|
|
175
188
|
},
|
|
176
189
|
workflowKey("release", path, ["name"], "release"),
|
|
177
190
|
workflowKey("release", path, ["on"], { push: { branches: [defaultBranch(ctx.config)] } }),
|
|
@@ -182,6 +195,26 @@ export const githubPlatform = {
|
|
|
182
195
|
// biome-ignore lint/suspicious/noTemplateCurlyInString: a GitHub Actions expression, not a JS template
|
|
183
196
|
secrets: { token: "${{ secrets.RELEASE_PLEASE_TOKEN }}" },
|
|
184
197
|
}),
|
|
198
|
+
// GitHub holds the pull_request runs of a pull request that GITHUB_TOKEN opened until someone
|
|
199
|
+
// approves them, so required checks never report; approve them for the release pull request
|
|
200
|
+
workflowKey("release", path, ["jobs", "release-pr-ci"], {
|
|
201
|
+
needs: "release",
|
|
202
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: a GitHub Actions expression, not a JS template
|
|
203
|
+
if: "${{ needs.release.outputs.pr_branch != '' }}",
|
|
204
|
+
"runs-on": "ubuntu-latest",
|
|
205
|
+
permissions: { actions: "write" },
|
|
206
|
+
steps: [
|
|
207
|
+
{
|
|
208
|
+
env: {
|
|
209
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: a GitHub Actions expression, not a JS template
|
|
210
|
+
GH_TOKEN: "${{ github.token }}",
|
|
211
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: a GitHub Actions expression, not a JS template
|
|
212
|
+
BRANCH: "${{ needs.release.outputs.pr_branch }}",
|
|
213
|
+
},
|
|
214
|
+
run: APPROVE_RELEASE_PR_RUNS,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
}),
|
|
185
218
|
];
|
|
186
219
|
},
|
|
187
220
|
};
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
export const PACKAGE_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
3
3
|
/** The standard this build of repokeeper applies. Bump it whenever generated output changes. */
|
|
4
|
-
export const STANDARD_VERSION = "1.
|
|
4
|
+
export const STANDARD_VERSION = "1.4.1";
|
|
5
5
|
export const TOOL_VERSIONS = {
|
|
6
6
|
lefthook: "2.1.14",
|
|
7
7
|
commitlintCli: "21.2.3",
|
package/package.json
CHANGED