backport
Version:
A CLI tool that automates the process of backporting commits
37 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchPullRequestAutoMergeMethod = void 0;
const generated_1 = require("../../../graphql/generated");
const graphqlClient_1 = require("./client/graphqlClient");
async function fetchPullRequestAutoMergeMethod(options, pullNumber) {
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner } = options;
const query = (0, generated_1.graphql)(`
query PullRequestAutoMergeMethod(
$repoOwner: String!
$repoName: String!
$pullNumber: Int!
) {
repository(owner: $repoOwner, name: $repoName) {
pullRequest(number: $pullNumber) {
autoMergeRequest {
enabledAt
mergeMethod
}
}
}
}
`);
const variables = {
repoOwner,
repoName,
pullNumber,
};
const client = (0, graphqlClient_1.getGraphQLClient)({ accessToken, githubApiBaseUrlV4 });
const result = await client.query(query, variables);
if (result.error) {
throw new graphqlClient_1.GithubV4Exception(result);
}
return result.data?.repository?.pullRequest?.autoMergeRequest?.mergeMethod;
}
exports.fetchPullRequestAutoMergeMethod = fetchPullRequestAutoMergeMethod;
//# sourceMappingURL=fetchPullRequestAutoMergeMethod.js.map