Compare commits
10 Commits
body_path_
...
retry-api
Author | SHA1 | Date | |
---|---|---|---|
e234343e3e | |||
c99850e5d1 | |||
845942e04a | |||
1a522d88d8 | |||
2e7c800734 | |||
6247f9299a | |||
5d578441a6 | |||
42a316b84f | |||
6ecc92f5ad | |||
e7b71cc1a7 |
@ -1,3 +1,7 @@
|
||||
## 0.1.3
|
||||
|
||||
* Fixed where `with: body_path` was not being used in generated GitHub releases
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* Add support for merging draft releases [#16](https://github.com/softprops/action-gh-release/pull/16)
|
||||
|
25
README.md
25
README.md
@ -1,9 +1,28 @@
|
||||
|
||||
# action gh-release [](https://github.com/softprops/action-gh-release/actions)
|
||||
<div align="center">
|
||||
📦 :octocat:
|
||||
</div>
|
||||
<h1 align="center">
|
||||
action gh-release
|
||||
</h1>
|
||||
|
||||
> A GitHub Action for creating GitHub Releases on Linux, Windows, and OSX virtual environments
|
||||
<p align="center">
|
||||
A GitHub Action for creating GitHub Releases on Linux, Windows, and OSX virtual environments
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<img src="demo.png"/>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/softprops/action-gh-release/actions">
|
||||
<img src="https://github.com/softprops/action-gh-release/workflows/Main/badge.svg"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
|
||||

|
||||
|
||||
|
||||
> **⚠️ Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/).
|
||||
|
@ -6,7 +6,7 @@ inputs:
|
||||
body:
|
||||
description: 'Note-worthy description of changes in release'
|
||||
required: false
|
||||
body-path:
|
||||
body_path:
|
||||
description: 'Path to load note-worthy description of changes in release from'
|
||||
required: false
|
||||
name:
|
||||
@ -23,6 +23,9 @@ inputs:
|
||||
required: false
|
||||
env:
|
||||
'GITHUB_TOKEN': 'As provided by Github Actions'
|
||||
outputs:
|
||||
url:
|
||||
description: 'URL to the Release HTML Page'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/main.js'
|
||||
|
@ -31,7 +31,8 @@ class GitHubReleaser {
|
||||
return this.github.repos.createRelease(params);
|
||||
}
|
||||
allReleases(params) {
|
||||
return this.github.paginate.iterator(this.github.repos.listReleases.endpoint.merge(params));
|
||||
const updatedParams = Object.assign({ per_page: 100 }, params);
|
||||
return this.github.paginate.iterator(this.github.repos.listReleases.endpoint.merge(updatedParams));
|
||||
}
|
||||
}
|
||||
exports.GitHubReleaser = GitHubReleaser;
|
||||
|
17
lib/main.js
17
lib/main.js
@ -21,7 +21,21 @@ function run() {
|
||||
if (!util_1.isTag(config.github_ref)) {
|
||||
throw new Error(`⚠️ GitHub Releases requires a tag`);
|
||||
}
|
||||
const gh = new github_2.GitHub(config.github_token);
|
||||
github_2.GitHub.plugin(require("@octokit/plugin-throttling"));
|
||||
const gh = new github_2.GitHub(config.github_token, {
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
console.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
console.log(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
// does not retry, only logs a warning
|
||||
console.warn(`Abuse detected for request ${options.method} ${options.url}`);
|
||||
}
|
||||
});
|
||||
let rel = yield github_1.release(config, new github_1.GitHubReleaser(gh));
|
||||
if (config.input_files) {
|
||||
util_1.paths(config.input_files).forEach((path) => __awaiter(this, void 0, void 0, function* () {
|
||||
@ -29,6 +43,7 @@ function run() {
|
||||
}));
|
||||
}
|
||||
console.log(`🎉 Release ready at ${rel.html_url}`);
|
||||
core_1.setOutput("url", rel.html_url);
|
||||
}
|
||||
catch (error) {
|
||||
core_1.setFailed(error.message);
|
||||
|
15
package-lock.json
generated
15
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "action-gh-release",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -440,6 +440,14 @@
|
||||
"universal-user-agent": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-throttling": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-2.6.0.tgz",
|
||||
"integrity": "sha512-E0xQrcD36sVEeBhut6j9nWX38vm/1LKMRSUqjvJ/mqGLXfHr4jYMsrR3I/nT2QC0eJL1/SKMt7zxOt7pZiFhDA==",
|
||||
"requires": {
|
||||
"bottleneck": "^2.15.3"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.1.0.tgz",
|
||||
@ -943,6 +951,11 @@
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
|
||||
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
|
||||
},
|
||||
"bottleneck": {
|
||||
"version": "2.19.5",
|
||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "action-gh-release",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"private": true,
|
||||
"description": "GitHub Action for creating GitHub Releases",
|
||||
"main": "lib/main.js",
|
||||
@ -21,6 +21,7 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/github": "^1.1.0",
|
||||
"@octokit/plugin-throttling": "^2.6.0",
|
||||
"glob": "^7.1.4",
|
||||
"mime": "^2.4.4"
|
||||
},
|
||||
|
@ -70,8 +70,9 @@ export class GitHubReleaser implements Releaser {
|
||||
owner: string;
|
||||
repo: string;
|
||||
}): AsyncIterableIterator<{ data: Release[] }> {
|
||||
const updatedParams = { per_page: 100, ...params };
|
||||
return this.github.paginate.iterator(
|
||||
this.github.repos.listReleases.endpoint.merge(params)
|
||||
this.github.repos.listReleases.endpoint.merge(updatedParams)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
23
src/main.ts
23
src/main.ts
@ -1,6 +1,6 @@
|
||||
import { paths, parseConfig, isTag } from "./util";
|
||||
import { release, upload, GitHubReleaser } from "./github";
|
||||
import { setFailed } from "@actions/core";
|
||||
import { setFailed, setOutput } from "@actions/core";
|
||||
import { GitHub } from "@actions/github";
|
||||
import { env } from "process";
|
||||
|
||||
@ -10,7 +10,25 @@ async function run() {
|
||||
if (!isTag(config.github_ref)) {
|
||||
throw new Error(`⚠️ GitHub Releases requires a tag`);
|
||||
}
|
||||
const gh = new GitHub(config.github_token);
|
||||
GitHub.plugin(require("@octokit/plugin-throttling"));
|
||||
const gh = new GitHub(config.github_token, {
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
console.warn(
|
||||
`Request quota exhausted for request ${options.method} ${options.url}`
|
||||
);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
console.log(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
// does not retry, only logs a warning
|
||||
console.warn(
|
||||
`Abuse detected for request ${options.method} ${options.url}`
|
||||
);
|
||||
}
|
||||
});
|
||||
let rel = await release(config, new GitHubReleaser(gh));
|
||||
if (config.input_files) {
|
||||
paths(config.input_files).forEach(async path => {
|
||||
@ -18,6 +36,7 @@ async function run() {
|
||||
});
|
||||
}
|
||||
console.log(`🎉 Release ready at ${rel.html_url}`);
|
||||
setOutput("url", rel.html_url);
|
||||
} catch (error) {
|
||||
setFailed(error.message);
|
||||
}
|
||||
|
Reference in New Issue
Block a user