Skip to content

Commit

Permalink
fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Sep 26, 2023
1 parent da4b77e commit fd4b55f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/github/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class CommentsApi {
public readonly pullData: { repo: string; owner: string; number: number },
) {}

async comment(message: string) {
async comment(message: string): Promise<void> {
await this.api.rest.issues.createComment({
...this.pullData,
body: message,
Expand Down
12 changes: 6 additions & 6 deletions src/github/merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export const ENABLE_AUTO_MERGE = `
mutation($prId: ID!, $mergeMethod: PullRequestMergeMethod!) {
enablePullRequestAutoMerge(input: {pullRequestId: $prId, mergeMethod: $mergeMethod}) {
clientMutationId
}
}
}`;

// https://docs.github.com/en/graphql/reference/mutations#disablepullrequestautomerge
export const DISABLE_AUTO_MERGE = `
mutation($prId: ID!) {
disablePullRequestAutoMerge(input: {pullRequestId: $prId}) {
clientMutationId
}
}
}`;

export type MergeMethod = "SQUASH" | "MERGE" | "REBASE";
Expand All @@ -29,8 +29,8 @@ export class Merger {
private readonly mergeMethod: PullRequestMergeMethod,
) {}

async enableAutoMerge() {
const mergeRequest = await this.gql<{
async enableAutoMerge(): Promise<void> {
await this.gql<{
enablePullRequestAutoMerge: { clientMutationId: unknown };
}>(ENABLE_AUTO_MERGE, {
prId: this.nodeId,
Expand All @@ -39,8 +39,8 @@ export class Merger {
this.logger.info("Succesfully enabled auto-merge");
}

async disableAutoMerge() {
const mergeRequest = await this.gql<{
async disableAutoMerge(): Promise<void> {
await this.gql<{
disablePullRequestAutoMerge: { clientMutationId: unknown };
}>(DISABLE_AUTO_MERGE, {
prId: this.nodeId,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ logger.info(`Received event of typer ${context.eventName}`);

if (context.eventName !== "issue_comment") {
throw new Error("Wrong event type");
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
} else if (!context.payload.issue?.pull_request) {
throw new Error("Comment happened on an issue, not a PR");
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/queries.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { validate, PullRequestMergeMethod } from "@octokit/graphql-schema";
import { validate } from "@octokit/graphql-schema";

import { ENABLE_AUTO_MERGE, DISABLE_AUTO_MERGE } from "../github/merger";

Expand Down

0 comments on commit fd4b55f

Please sign in to comment.