Skip to content

Commit

Permalink
fix(app): setup was failing with "Error: Branch undefined not found" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Oct 31, 2022
2 parents ba4fc06 + b30a8df commit 695b261
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/webhooks.ts
Expand Up @@ -92,7 +92,7 @@ const associated = (context: Context) => {
};

const isDenoProject = async (github: GitHubClient) => {
const tree = await github.getTree();
const tree = await github.getTree(await github.defaultBranch());
const paths = tree.map((blob) => blob.path!);

const targets = ["deno.json", "deno.jsonc"];
Expand Down
6 changes: 3 additions & 3 deletions mod/octokit.ts
Expand Up @@ -97,20 +97,20 @@ export class GitHubClient {
return data.default_branch;
}

async getBranch(branch?: string) {
async getBranch(branch: string) {
const { owner, repo } = this.ensureRepository();
try {
const { data } = await this.octokit.request(
"GET /repos/{owner}/{repo}/branches/{branch}",
{ owner, repo, branch: (branch ?? await this.defaultBranch()) },
{ owner, repo, branch },
);
return data;
} catch {
return null;
}
}

async getTree(branch?: string) {
async getTree(branch: string) {
const { owner, repo } = this.ensureRepository();

const head = await this.getBranch(branch);
Expand Down

0 comments on commit 695b261

Please sign in to comment.