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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ scripts/polkadot-launch/*.log

target
.env
**/.yarn/

node_modules/
**/yarn-error.log
**/.yarn/
18 changes: 18 additions & 0 deletions scripts/github/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "github",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"octokit": "^1.7.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.4",
"yargs": "^17.3.1"
},
"scripts": {
"update-release-body": "ts-node ./update-release-body.ts"
}
}



9 changes: 9 additions & 0 deletions scripts/github/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es2020",
"module": "commonjs"
},
"exclude": ["node_modules", "tests"]
}
33 changes: 33 additions & 0 deletions scripts/github/update-release-body.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Octokit } from "octokit";
import yargs from "yargs";

async function main() {
const argv = yargs(process.argv.slice(2))
.usage("Usage: npm run update-release-body [args]")
.version("1.0.0")
.options({
id: {
type: "string",
describe: "id of the release to update",
},
body: {
type: "string",
describe: "newly updated body",
},
})
.demandOption(["id", "body", "repo"])
.help().argv;

const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN || undefined,
});

await octokit.request("PATCH /repos/{owner}/{repo}/releases/{release_id}", {
owner: argv.repo.split("/")[0],
repo: argv.repo.split("/")[1],
release_id: argv.id,
body: argv.body,
});
}

main();
Loading