refresh pr

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2025-06-10 20:45:09 -04:00
parent a6b02d29ce
commit 3ecccfdb3a
No known key found for this signature in database
GPG key ID: 6577287BDCA70840
4 changed files with 2210 additions and 3655 deletions

View file

@ -17,9 +17,9 @@ describe("util", () => {
it("strips template", () => { it("strips template", () => {
assert.equal( assert.equal(
uploadUrl( uploadUrl(
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}" "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
), ),
"https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets" "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets",
); );
}); });
}); });
@ -33,7 +33,7 @@ describe("util", () => {
it("parses newline and comma-delimited (and then some)", () => { it("parses newline and comma-delimited (and then some)", () => {
assert.deepStrictEqual( assert.deepStrictEqual(
parseInputFiles("foo,bar\nbaz,boom,\n\ndoom,loom "), parseInputFiles("foo,bar\nbaz,boom,\n\ndoom,loom "),
["foo", "bar", "baz", "boom", "doom", "loom"] ["foo", "bar", "baz", "boom", "doom", "loom"],
); );
}); });
}); });
@ -58,7 +58,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
}) }),
); );
}); });
it("uses input body path", () => { it("uses input body path", () => {
@ -81,7 +81,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
}) }),
); );
}); });
it("defaults to body path when both body and body path are provided", () => { it("defaults to body path when both body and body path are provided", () => {
@ -104,7 +104,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
}) }),
); );
}); });
}); });
@ -140,7 +140,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
@ -168,7 +168,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
it("supports discussion category names", () => { it("supports discussion category names", () => {
@ -195,7 +195,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
@ -223,7 +223,7 @@ describe("util", () => {
input_generate_release_notes: true, input_generate_release_notes: true,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
@ -255,7 +255,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
it("uses input token as the source of GITHUB_TOKEN by default", () => { it("uses input token as the source of GITHUB_TOKEN by default", () => {
@ -284,7 +284,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
it("parses basic config with draft and prerelease", () => { it("parses basic config with draft and prerelease", () => {
@ -311,7 +311,7 @@ describe("util", () => {
input_discussion_category_name: undefined, input_discussion_category_name: undefined,
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
} },
); );
}); });
it("parses basic config where make_latest is passed", () => { it("parses basic config where make_latest is passed", () => {
@ -338,7 +338,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: "false", input_make_latest: "false",
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
it("parses basic config with append_body", () => { it("parses basic config with append_body", () => {
@ -365,7 +365,7 @@ describe("util", () => {
input_generate_release_notes: false, input_generate_release_notes: false,
input_make_latest: undefined, input_make_latest: undefined,
input_previous_tag: undefined, input_previous_tag: undefined,
} },
); );
}); });
}); });
@ -382,7 +382,7 @@ describe("util", () => {
it("resolves files given a set of paths", async () => { it("resolves files given a set of paths", async () => {
assert.deepStrictEqual( assert.deepStrictEqual(
paths(["tests/data/**/*", "tests/data/does/not/exist/*"]), paths(["tests/data/**/*", "tests/data/does/not/exist/*"]),
["tests/data/foo/bar.txt"] ["tests/data/foo/bar.txt"],
); );
}); });
}); });
@ -391,7 +391,7 @@ describe("util", () => {
it("returns the patterns that don't match any files", async () => { it("returns the patterns that don't match any files", async () => {
assert.deepStrictEqual( assert.deepStrictEqual(
unmatchedPatterns(["tests/data/**/*", "tests/data/does/not/exist/*"]), unmatchedPatterns(["tests/data/**/*", "tests/data/does/not/exist/*"]),
["tests/data/does/not/exist/*"] ["tests/data/does/not/exist/*"],
); );
}); });
}); });
@ -403,7 +403,7 @@ describe("util", () => {
it("handles names with multiple spaces", () => { it("handles names with multiple spaces", () => {
expect(alignAssetName("John William Doe.bla")).toBe( expect(alignAssetName("John William Doe.bla")).toBe(
"John.William.Doe.bla" "John.William.Doe.bla",
); );
}); });

5780
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,14 @@
{ {
"name": "action-gh-release", "name": "action-gh-release",
"version": "2.0.5", "version": "2.3.2",
"private": true, "private": true,
"description": "GitHub Action for creating GitHub Releases", "description": "GitHub Action for creating GitHub Releases",
"main": "lib/main.js", "main": "lib/main.js",
"scripts": { "scripts": {
"build": "ncc build src/main.ts --minify", "build": "ncc build src/main.ts --minify --target es2022",
"test": "jest", "build-debug": "ncc build src/main.ts --v8-cache --source-map",
"typecheck": "tsc --noEmit",
"test": "vitest --coverage",
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"", "fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"", "fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
"updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2" "updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2"
@ -20,24 +22,23 @@
], ],
"author": "softprops", "author": "softprops",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.11.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.1",
"@octokit/plugin-retry": "^7.0.3", "@octokit/plugin-retry": "^8.0.1",
"@octokit/plugin-throttling": "^9.0.3", "@octokit/plugin-throttling": "^11.0.1",
"glob": "^10.3.10", "glob": "^11.0.2",
"mime": "^4.0.1" "mime-types": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/glob": "^8.1.0", "@types/glob": "^8.1.0",
"@types/jest": "^29.5.12", "@types/mime-types": "^3.0.1",
"@types/mime": "^3.0.4", "@types/node": "^20.17.32",
"@types/node": "^20.11.28", "@vercel/ncc": "^0.38.3",
"@vercel/ncc": "^0.38.1", "@vitest/coverage-v8": "^3.1.4",
"jest": "^29.7.0", "prettier": "3.5.3",
"jest-circus": "^29.7.0", "ts-node": "^10.9.2",
"prettier": "3.2.5", "typescript": "^5.8.3",
"ts-jest": "^29.1.2", "typescript-formatter": "^7.2.2",
"typescript": "^5.4.2", "vitest": "^3.1.4"
"typescript-formatter": "^7.2.2"
} }
} }

View file

@ -298,7 +298,6 @@ export const release = async (
target_commitish = existingRelease.target_commitish; target_commitish = existingRelease.target_commitish;
} }
const tag_name = tag;
const name = config.input_name || existingRelease.name || tag; const name = config.input_name || existingRelease.name || tag;
// revisit: support a new body-concat-strategy input for accumulating // revisit: support a new body-concat-strategy input for accumulating
// body parts as a release gets updated. some users will likely want this while // body parts as a release gets updated. some users will likely want this while
@ -306,7 +305,7 @@ export const release = async (
// no one wants // no one wants
const workflowBody = releaseBody(config) || ""; const workflowBody = releaseBody(config) || "";
const existingReleaseBody = existingRelease.body || ""; const existingReleaseBody = existingRelease.body || "";
let body: string;
if (config.input_append_body && workflowBody && existingReleaseBody) { if (config.input_append_body && workflowBody && existingReleaseBody) {
console.log(" Appending existing release body"); console.log(" Appending existing release body");
body = body + existingReleaseBody + "\n" + workflowBody; body = body + existingReleaseBody + "\n" + workflowBody;
@ -452,7 +451,7 @@ async function createRelease(
const draft = config.input_draft; const draft = config.input_draft;
const prerelease = config.input_prerelease; const prerelease = config.input_prerelease;
const target_commitish = config.input_target_commitish; const target_commitish = config.input_target_commitish;
const make_latest = config.input_make_latest; const make_latest = config.input_make_latest!;
let commitMessage: string = ""; let commitMessage: string = "";
if (target_commitish) { if (target_commitish) {
commitMessage = ` using commit "${target_commitish}"`; commitMessage = ` using commit "${target_commitish}"`;
@ -471,9 +470,8 @@ async function createRelease(
prerelease, prerelease,
target_commitish, target_commitish,
discussion_category_name, discussion_category_name,
generate_release_notes,
make_latest, make_latest,
}); } as CreateReleaseParams);
return release.data; return release.data;
} catch (error) { } catch (error) {
// presume a race with competing matrix runs // presume a race with competing matrix runs