chore: move docs-util to www (#7232)
* reorganize docs apps * add README * fix directory * add condition for old docs * move docs-util to www * remove remaining docs-util * fixes of paths * fix scripts * path fixes * fix github actions * add build packages script
This commit is contained in:
38
www/utils/packages/scripts/check-release-commit.ts
Normal file
38
www/utils/packages/scripts/check-release-commit.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Octokit } from "@octokit/core"
|
||||
import * as core from "@actions/core"
|
||||
|
||||
const commitSha = process.argv.length >= 3 ? process.argv[2] : null
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GH_TOKEN,
|
||||
})
|
||||
|
||||
async function checkReleaseCommit() {
|
||||
if (!commitSha) {
|
||||
throw new Error("Commit SHA is required.")
|
||||
}
|
||||
|
||||
// retrieve commit by the SHA
|
||||
const { data: commit } = await octokit.request(
|
||||
"GET /repos/{owner}/{repo}/commits/{ref}",
|
||||
{
|
||||
owner: process.env.GIT_OWNER || "",
|
||||
repo: process.env.GIT_REPO || "",
|
||||
ref: commitSha,
|
||||
headers: {
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!commit) {
|
||||
throw new Error("Commit doesn't exist.")
|
||||
}
|
||||
|
||||
core.setOutput(
|
||||
"is_release_commit",
|
||||
commit.commit.message === "chore: Release"
|
||||
)
|
||||
}
|
||||
|
||||
void checkReleaseCommit()
|
||||
Reference in New Issue
Block a user