Skip to content

Commit

Permalink
Fix JS syntax error
Browse files Browse the repository at this point in the history
It seems that the `foo?.bar` syntax is not compatible with whatever CJS
loader Actions is using.

Fixes #16
  • Loading branch information
mislav committed Mar 2, 2021
1 parent b7633ec commit 2958320
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const GitHub = Octokit.plugin(restEndpointMethods, requestLog).defaults({

export type API = InstanceType<typeof GitHub>

export default function (token: string, options?: {fetch?: any}): API {
export default function (token: string, options?: { fetch?: any }): API {
return new GitHub({
request: {fetch: options?.fetch},
request: { fetch: options && options.fetch },
auth: `token ${token}`,
log: {
info(msg: string) {
Expand Down
3 changes: 2 additions & 1 deletion src/edit-github-blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export default async function (params: Options): Promise<string> {
branch: baseBranch,
})

const needsFork = !repoRes.data.permissions?.push
const needsFork =
repoRes.data.permissions == null || !repoRes.data.permissions.push
if (needsFork) {
const res = await Promise.all([
api.repos.createFork(baseRepo),
Expand Down

0 comments on commit 2958320

Please sign in to comment.