Skip to content

Commit

Permalink
fix: remove github console log
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Aug 30, 2020
1 parent 38a7eeb commit a6b6859
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions plugins/github/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export async function createRelease(
},
body: JSON.stringify(release),
});
console.log(res);
if (res.status !== 200) return { ok: false, err: "Non-zero status" };
console.log(await res.json());
if (res.status !== 201) return { ok: false, err: "Release not created" };
return { ok: true };
}
4 changes: 3 additions & 1 deletion plugins/github/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "../../src/changelog.ts";

import * as gh from "./api.ts";
import { ReleaseError } from "../../src/error.ts";

const logger = log.prefix("gh");

Expand Down Expand Up @@ -71,13 +72,14 @@ export const github = <ReleasePlugin> {
if (!config.dry) {
let token = (await store.get(store.known.github)) as string;
const { user, name } = repo.remote.github;
gh.createRelease(token, user, name, {
const result = await gh.createRelease(token, user, name, {
tag_name: to,
name: `v${to}`,
body: render(doc),
prerelease: action.startsWith("pre"),
draft: true,
});
if (!result.ok) throw new ReleaseError("PLUGIN", result.err);
}
},
};
1 change: 1 addition & 0 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const causes = {
GIT_EXE: "non-zero status returned by a git command",
NO_REPO: "not a valid git repository",
UNINITIALIZED_REPO: "repo is not initialized",
PLUGIN: "plugin error",
};

export class ReleaseError extends Error {
Expand Down

0 comments on commit a6b6859

Please sign in to comment.