Skip to content
Merged
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
17 changes: 9 additions & 8 deletions utils/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,21 @@ function getReleaseInfo(data: GitHubRelease): ReleaseInfo {
};

function getChecksum() {
const assetName = getPluginKind() === "wasm" ? "plugin.wasm" : "plugin.json";
const asset = data.assets?.find((a) => a.name === assetName);
if (asset?.digest) {
const match = /^sha256:([a-f0-9]{64})$/i.exec(asset.digest);
if (match?.[1]) {
return match[1];
}
}
// fall back to searching the body text for a dprint style checksum
if (typeof data.body === "string") {
// search the body text for a dprint style checksum
const checksum = /\@([a-z0-9]{64})\b/i.exec(data.body);
if (checksum?.[1]) {
return checksum[1];
}
}
// fall back to the digest from the release asset
const assetName = getPluginKind() === "wasm" ? "plugin.wasm" : "plugin.json";
const asset = data.assets?.find((a) => a.name === assetName);
if (asset?.digest) {
const match = /^sha256:([a-f0-9]{64})$/i.exec(asset.digest);
return match?.[1];
}
return undefined;
}

Expand Down
Loading