Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/scripts/sdk-docs-readme.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ test("only a release tag syncs, and hand edits to synced pages fail the check",
assert.throws(() => planReadme({ name: "python-sdk", source }), /not the v0\.2\.0 release tag/);
git("tag", "v0.2.0");

fs.writeFileSync(path.join(source, "README.md"), "# Unreleased edit\n");
fs.writeFileSync(path.join(source, ".release-please-manifest.json"), '{ ".": "9.9.9" }\n');
const files = planReadme({ name: "python-sdk", source });
assert.match(files.get("supported-languages/python-sdk.md"), /# Reflag Python SDK/);
assert(!files.get("supported-languages/python-sdk.md").includes("Unreleased edit"));
applyReadme(files, destination);
applyReadme(files, destination, { check: true });
assert.deepEqual(checkReadmeManifests(destination), ["supported-languages/python-sdk.md"]);
Expand Down
7 changes: 3 additions & 4 deletions .github/scripts/sdk-readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ export function planReadme({ name, source }) {
const sdk = readmeSDKs[name];
assert(sdk, `Unknown README SDK: ${name}`);
const commit = git(source, "rev-parse", "HEAD");
const version = JSON.parse(fs.readFileSync(path.join(source, ".release-please-manifest.json")))[
"."
];
// Read from the commit, not the working tree, so local edits can't pass as released.
const version = JSON.parse(git(source, "show", "HEAD:.release-please-manifest.json"))["."];
assert(/^\d+\.\d+\.\d+$/.test(version ?? ""), `Invalid release version: ${version}`);
// Only released READMEs are published, so the page matches the package users install.
assert(
Expand All @@ -82,7 +81,7 @@ export function planReadme({ name, source }) {
);
const page = renderReadme({
name,
readme: fs.readFileSync(path.join(source, "README.md"), "utf8"),
readme: git(source, "show", "HEAD:README.md"),
commit,
});
const manifest = {
Expand Down
Loading