Skip to content

Commit

Permalink
[Refactor] runQuery: convert args to object
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 24, 2021
1 parent ba45670 commit 84bca41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"rules": {
"func-style": "off",
"id-length": ["error", { "min": 1, "max": 64 }],
"object-curly-newline": "off",
"sort-keys": "off",
},

"overrides": [
Expand Down
5 changes: 4 additions & 1 deletion bin/can-merge
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ function outputStatus(response) {
}
}

runQuery(args.pr, String(args.repo), args.sha, token).then((response) => {
const { repo, pr, sha } = args;
const params = { repo: String(repo), pr, sha, token };

runQuery(params).then((response) => {
outputStatus(response);
});
5 changes: 1 addition & 4 deletions utils/runQuery.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/* eslint-disable object-curly-newline */
/* eslint-disable max-params */

'use strict';

const { graphql } = require('@octokit/graphql');

const buildQuery = require('./buildQuery');

module.exports = async function runQuery(pr, repo, sha, token) {
module.exports = async function runQuery({ repo, pr, sha, token }) {
const [owner, name] = repo.split('/');
const response = await graphql(buildQuery({ name, owner, pr, sha }), {
headers: {
Expand Down

0 comments on commit 84bca41

Please sign in to comment.