Readme

Submit a PR from Val Town

This val provides a (very) thin wrapper around the GH rest API methods for creating a pull request. It handles the creation of a Octokit client for you.

Usage

import { submitPR } from "https://esm.town/v/nbbaier/submitPR"; await submitPR(Deno.env.get("GH_REPO_TOKEN"), { owner: "nbbaier", repo: "test-ground", head: "branch_2", base: "main", title: "trying another PR", body: "cool stuff, take a look", });

Parameters

The function takes two parameters: your gh access token and an object that's identical to the object submitted to the gh API. See GH's documentation for more info!

1
2
3
4
5
6
import { Octokit } from "npm:@octokit/rest";
type PR = Parameters<typeof Octokit["rest"]["pulls"]["create"]>;
export async function submitPR(ghToken: string, ...pr: PR) {
return new Octokit({ auth: ghToken }).rest.pulls.create(pr);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
February 26, 2024