Skip to main content
Deno 2 is finally here 🎉️
Learn more

Codemod

deno doc

Codemod module for making deterministic code modifications on GitHub.

Usage

import { GitHubCodemodBuilder } from "https://deno.land/x/codemod/github/mod.ts";

const result = await new GitHubCodemodBuilder({
  owner: "EthanThatOneKid",
  repo: "codemod",
  token: GITHUB_TOKEN,
})
  .setText("hello_world.txt", "Hello, World!")
  .editText("friends.json", (content) => {
    const friends = JSON.parse(content);
    friends.push("EthanThatOneKid");
    return JSON.stringify(friends);
  })
  .delete("goodbye_world.txt")
  .createPR({
    title: "Hello, World!",
    body: "This is a test PR.",
    message: "Add hello_world.txt",
    newBranchName: "hello-world",
  });

Get a GitHub personal access token here.

Fine-tune your personal access token by granting Read and write access to only Contents and Pull requests.

API

See https://deno.land/x/codemod for generated API documentation.

License

MIT


Made with 💖 by @EthanThatOneKid