mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-11-16 11:09:47 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5be0e66d93 | ||
|
|
af658b4d5d | ||
|
|
237aaccf71 | ||
|
|
00362bea6f | ||
|
|
0adea5aa98 | ||
|
|
aa05f9d779 | ||
|
|
bbaccb3a0c | ||
|
|
50fda3f773 | ||
|
|
5434409c2b |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
|
||||
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v4
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
node-version-file: ".tool-versions"
|
||||
cache: "npm"
|
||||
|
||||
@@ -1 +1 @@
|
||||
nodejs 24.2.0
|
||||
nodejs 24.11.0
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,3 +1,15 @@
|
||||
## 2.4.2
|
||||
|
||||
## What's Changed
|
||||
|
||||
### Exciting New Features 🎉
|
||||
|
||||
* feat: Ensure generated release notes cannot be over 125000 characters by @BeryJu in https://github.com/softprops/action-gh-release/pull/684
|
||||
|
||||
### Other Changes 🔄
|
||||
|
||||
- dependency updates
|
||||
|
||||
## 2.4.1
|
||||
|
||||
## What's Changed
|
||||
|
||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
1165
package-lock.json
generated
1165
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "action-gh-release",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.2",
|
||||
"private": true,
|
||||
"description": "GitHub Action for creating GitHub Releases",
|
||||
"main": "lib/main.js",
|
||||
@@ -24,21 +24,21 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.1",
|
||||
"@octokit/plugin-retry": "^8.0.2",
|
||||
"@octokit/plugin-throttling": "^11.0.2",
|
||||
"@octokit/plugin-retry": "^8.0.3",
|
||||
"@octokit/plugin-throttling": "^11.0.3",
|
||||
"glob": "^11.0.3",
|
||||
"mime-types": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/glob": "^9.0.0",
|
||||
"@types/mime-types": "^3.0.1",
|
||||
"@types/node": "^20.19.19",
|
||||
"@types/node": "^20.19.24",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"@vitest/coverage-v8": "^4.0.6",
|
||||
"prettier": "3.6.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
"vitest": "^3.1.4"
|
||||
"vitest": "^4.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,27 @@ export class GitHubReleaser implements Releaser {
|
||||
return this.github.rest.repos.getReleaseByTag(params);
|
||||
}
|
||||
|
||||
createRelease(params: {
|
||||
async getReleaseNotes(params: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
tag_name: string;
|
||||
target_commitish: string | undefined;
|
||||
}): Promise<{
|
||||
data: {
|
||||
name: string;
|
||||
body: string;
|
||||
};
|
||||
}> {
|
||||
return await this.github.rest.repos.generateReleaseNotes(params);
|
||||
}
|
||||
|
||||
truncateReleaseNotes(input: string): string {
|
||||
// release notes can be a maximum of 125000 characters
|
||||
const githubNotesMaxCharLength = 125000;
|
||||
return input.substring(0, githubNotesMaxCharLength - 1);
|
||||
}
|
||||
|
||||
async createRelease(params: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
tag_name: string;
|
||||
@@ -94,11 +114,20 @@ export class GitHubReleaser implements Releaser {
|
||||
) {
|
||||
params.make_latest = undefined;
|
||||
}
|
||||
|
||||
if (params.generate_release_notes) {
|
||||
const releaseNotes = await this.getReleaseNotes(params);
|
||||
params.generate_release_notes = false;
|
||||
if (params.body) {
|
||||
params.body = `${params.body}\n\n${releaseNotes.data.body}`;
|
||||
} else {
|
||||
params.body = releaseNotes.data.body;
|
||||
}
|
||||
}
|
||||
params.body = params.body ? this.truncateReleaseNotes(params.body) : undefined;
|
||||
return this.github.rest.repos.createRelease(params);
|
||||
}
|
||||
|
||||
updateRelease(params: {
|
||||
async updateRelease(params: {
|
||||
owner: string;
|
||||
repo: string;
|
||||
release_id: number;
|
||||
@@ -118,7 +147,16 @@ export class GitHubReleaser implements Releaser {
|
||||
) {
|
||||
params.make_latest = undefined;
|
||||
}
|
||||
|
||||
if (params.generate_release_notes) {
|
||||
const releaseNotes = await this.getReleaseNotes(params);
|
||||
params.generate_release_notes = false;
|
||||
if (params.body) {
|
||||
params.body = `${params.body}\n\n${releaseNotes.data.body}`;
|
||||
} else {
|
||||
params.body = releaseNotes.data.body;
|
||||
}
|
||||
}
|
||||
params.body = params.body ? this.truncateReleaseNotes(params.body) : undefined;
|
||||
return this.github.rest.repos.updateRelease(params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user