createCodemod
import { createCodemod } from "https://raw.githubusercontent.com/EthanThatOneKid/codemod/main/github/mod.ts";
Creates a codemod builder and runs it.
@example
const results = await createCodemod((builder) =>
builder
.createTree(
(tree) =>
tree
.text("hello_world.txt", "Hello, Ethan!\n")
)
.createCommit(({ 0: tree }) => ({
message: "Add Ethan as a new friend",
tree: tree.sha,
}), (commit) =>
commit
.parentRef("new-branch"))
.createOrUpdateBranch(({ 1: commit }) => ({
ref: "new-branch",
sha: commit.sha,
}))
.maybeCreatePR({
title: "Add Ethan as a new friend",
body: "This is a test PR.",
head: "new-branch",
base: "", // Defaults to repository's default branch.
}), {
owner: "EthanThatOneKid",
repo: "pomo",
token: GITHUB_TOKEN,
});
console.log(results);
async function createCodemod<R extends GitHubOpResult[]>(builderOrBuilderGenerate: Generate<GitHubCodemodBuilderInterface<R>, [GitHubCodemodBuilderInterface]>, options: GitHubAPIClientOptions): Promise<R>;
§
createCodemod<R extends GitHubOpResult[]>(builderOrBuilderGenerate: Generate<GitHubCodemodBuilderInterface<R>, [GitHubCodemodBuilderInterface]>, options: GitHubAPIClientOptions): Promise<R>
[src]§Type Parameters
§
R extends GitHubOpResult[]
[src]§Parameters
§
builderOrBuilderGenerate: Generate<GitHubCodemodBuilderInterface<R>, [GitHubCodemodBuilderInterface]>
[src]§
options: GitHubAPIClientOptions
[src]