Socket
Socket
Sign inDemoInstall

@shelf/gh-sdk

Package Overview
Dependencies
18
Maintainers
58
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

lib/misc/get-orgs.test.d.ts

7

lib/index.d.ts

@@ -1,3 +0,4 @@

export * from './prs';
export * from './repos';
export * from './misc';
export * from './prs/index.js';
export * from './repos/index.js';
export * from './misc/index.js';
export * from './rest-client.js';

@@ -1,38 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _prs = require("./prs");
Object.keys(_prs).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _prs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _prs[key];
}
});
});
var _repos = require("./repos");
Object.keys(_repos).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _repos[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _repos[key];
}
});
});
var _misc = require("./misc");
Object.keys(_misc).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _misc[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _misc[key];
}
});
});
export * from './prs/index.js';
export * from './repos/index.js';
export * from './misc/index.js';
export * from './rest-client.js';

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getUserOrgs = getUserOrgs;
var _restClient = require("../rest-client");
async function getUserOrgs() {
const gh = (0, _restClient.getClient)();
const [{
data: orgsData
}, {
data: currentUserData
}] = await Promise.all([gh.orgs.listForAuthenticatedUser(), gh.users.getAuthenticated()]);
const orgNames = orgsData.map(item => item.login);
return [...orgNames, currentUserData.login].sort();
}
import { getClient } from '../rest-client.js';
export async function getUserOrgs() {
const gh = getClient();
const [{ data: orgsData }, { data: currentUserData }] = await Promise.all([
gh.orgs.listForAuthenticatedUser(),
gh.users.getAuthenticated(),
]);
const orgNames = orgsData.map(item => item.login);
return [...orgNames, currentUserData.login].sort();
}

@@ -1,1 +0,1 @@

export * from './get-orgs';
export * from './get-orgs.js';

@@ -1,16 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getOrgs = require("./get-orgs");
Object.keys(_getOrgs).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _getOrgs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _getOrgs[key];
}
});
});
export * from './get-orgs.js';

@@ -1,19 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.approvePR = approvePR;
var _restClient = require("../rest-client");
async function approvePR(params) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.pulls.createReview({
owner: params.owner,
repo: params.repo,
event: 'APPROVE',
pull_number: params.pr
});
return data;
}
import { getClient } from '../rest-client.js';
export async function approvePR(params) {
const gh = getClient();
const { data } = await gh.pulls.createReview({
owner: params.owner,
repo: params.repo,
event: 'APPROVE',
pull_number: params.pr,
});
return data;
}

@@ -1,2 +0,1 @@

import type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types';
export declare function createReleasePR({ owner, repo, version, releaseTitle, }: {

@@ -7,2 +6,559 @@ owner: string;

releaseTitle: string;
}): Promise<RestEndpointMethodTypes['pulls']['create']['response']['data']>;
}): Promise<{
url: string;
id: number;
node_id: string;
html_url: string;
diff_url: string;
patch_url: string;
issue_url: string;
commits_url: string;
review_comments_url: string;
review_comment_url: string;
comments_url: string;
statuses_url: string;
number: number;
state: "open" | "closed";
locked: boolean;
title: string;
user: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
};
body: string | null;
labels: {
id: number;
node_id: string;
url: string;
name: string;
description: string | null;
color: string;
default: boolean;
}[];
milestone: {
url: string;
html_url: string;
labels_url: string;
id: number;
node_id: string;
number: number;
state: "open" | "closed";
title: string;
description: string | null;
creator: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
open_issues: number;
closed_issues: number;
created_at: string;
updated_at: string;
closed_at: string | null;
due_on: string | null;
} | null;
active_lock_reason?: string | null | undefined;
created_at: string;
updated_at: string;
closed_at: string | null;
merged_at: string | null;
merge_commit_sha: string | null;
assignee: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
assignees?: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
}[] | null | undefined;
requested_reviewers?: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
}[] | null | undefined;
requested_teams?: {
id: number;
node_id: string;
url: string;
members_url: string;
name: string;
description: string | null;
permission: string;
privacy?: string | undefined;
notification_setting?: string | undefined;
html_url: string;
repositories_url: string;
slug: string;
ldap_dn?: string | undefined;
}[] | null | undefined;
head: {
label: string;
ref: string;
repo: {
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
description: string | null;
downloads_url: string;
events_url: string;
fork: boolean;
forks_url: string;
full_name: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
hooks_url: string;
html_url: string;
id: number;
node_id: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
name: string;
notifications_url: string;
owner: {
avatar_url: string;
events_url: string;
followers_url: string;
following_url: string;
gists_url: string;
gravatar_id: string | null;
html_url: string;
id: number;
node_id: string;
login: string;
organizations_url: string;
received_events_url: string;
repos_url: string;
site_admin: boolean;
starred_url: string;
subscriptions_url: string;
type: string;
url: string;
};
private: boolean;
pulls_url: string;
releases_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
url: string;
clone_url: string;
default_branch: string;
forks: number;
forks_count: number;
git_url: string;
has_downloads: boolean;
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_discussions: boolean;
homepage: string | null;
language: string | null;
master_branch?: string | undefined;
archived: boolean;
disabled: boolean;
visibility?: string | undefined;
mirror_url: string | null;
open_issues: number;
open_issues_count: number;
permissions?: {
admin: boolean;
maintain?: boolean | undefined;
push: boolean;
triage?: boolean | undefined;
pull: boolean;
} | undefined;
temp_clone_token?: string | undefined;
allow_merge_commit?: boolean | undefined;
allow_squash_merge?: boolean | undefined;
allow_rebase_merge?: boolean | undefined;
license: {
key: string;
name: string;
url: string | null;
spdx_id: string | null;
node_id: string;
} | null;
pushed_at: string;
size: number;
ssh_url: string;
stargazers_count: number;
svn_url: string;
topics?: string[] | undefined;
watchers: number;
watchers_count: number;
created_at: string;
updated_at: string;
allow_forking?: boolean | undefined;
is_template?: boolean | undefined;
web_commit_signoff_required?: boolean | undefined;
} | null;
sha: string;
user: {
avatar_url: string;
events_url: string;
followers_url: string;
following_url: string;
gists_url: string;
gravatar_id: string | null;
html_url: string;
id: number;
node_id: string;
login: string;
organizations_url: string;
received_events_url: string;
repos_url: string;
site_admin: boolean;
starred_url: string;
subscriptions_url: string;
type: string;
url: string;
};
};
base: {
label: string;
ref: string;
repo: {
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
description: string | null;
downloads_url: string;
events_url: string;
fork: boolean;
forks_url: string;
full_name: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
hooks_url: string;
html_url: string;
id: number;
is_template?: boolean | undefined;
node_id: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
name: string;
notifications_url: string;
owner: {
avatar_url: string;
events_url: string;
followers_url: string;
following_url: string;
gists_url: string;
gravatar_id: string | null;
html_url: string;
id: number;
node_id: string;
login: string;
organizations_url: string;
received_events_url: string;
repos_url: string;
site_admin: boolean;
starred_url: string;
subscriptions_url: string;
type: string;
url: string;
};
private: boolean;
pulls_url: string;
releases_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
url: string;
clone_url: string;
default_branch: string;
forks: number;
forks_count: number;
git_url: string;
has_downloads: boolean;
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_discussions: boolean;
homepage: string | null;
language: string | null;
master_branch?: string | undefined;
archived: boolean;
disabled: boolean;
visibility?: string | undefined;
mirror_url: string | null;
open_issues: number;
open_issues_count: number;
permissions?: {
admin: boolean;
maintain?: boolean | undefined;
push: boolean;
triage?: boolean | undefined;
pull: boolean;
} | undefined;
temp_clone_token?: string | undefined;
allow_merge_commit?: boolean | undefined;
allow_squash_merge?: boolean | undefined;
allow_rebase_merge?: boolean | undefined;
license: {
key: string;
name: string;
url: string | null;
spdx_id: string | null;
node_id: string;
html_url?: string | undefined;
} | null;
pushed_at: string;
size: number;
ssh_url: string;
stargazers_count: number;
svn_url: string;
topics?: string[] | undefined;
watchers: number;
watchers_count: number;
created_at: string;
updated_at: string;
allow_forking?: boolean | undefined;
web_commit_signoff_required?: boolean | undefined;
};
sha: string;
user: {
avatar_url: string;
events_url: string;
followers_url: string;
following_url: string;
gists_url: string;
gravatar_id: string | null;
html_url: string;
id: number;
node_id: string;
login: string;
organizations_url: string;
received_events_url: string;
repos_url: string;
site_admin: boolean;
starred_url: string;
subscriptions_url: string;
type: string;
url: string;
};
};
_links: {
comments: {
href: string;
};
commits: {
href: string;
};
statuses: {
href: string;
};
html: {
href: string;
};
issue: {
href: string;
};
review_comments: {
href: string;
};
review_comment: {
href: string;
};
self: {
href: string;
};
};
author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
auto_merge: {
enabled_by: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
};
merge_method: "merge" | "squash" | "rebase";
commit_title: string;
commit_message: string;
} | null;
draft?: boolean | undefined;
merged: boolean;
mergeable: boolean | null;
rebaseable?: boolean | null | undefined;
mergeable_state: string;
merged_by: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
comments: number;
review_comments: number;
maintainer_can_modify: boolean;
commits: number;
additions: number;
deletions: number;
changed_files: number;
}>;

@@ -1,27 +0,14 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createReleasePR = createReleasePR;
var _restClient = require("../rest-client");
async function createReleasePR({
owner,
repo,
version,
releaseTitle
}) {
const gh = (0, _restClient.getClient)();
const tagName = `v${version}`;
const branch = `release/${tagName}`;
const {
data
} = await gh.pulls.create({
owner,
repo,
head: branch,
base: 'master',
title: `Release ${tagName}: ${releaseTitle}`
});
return data;
}
import { getClient } from '../rest-client.js';
export async function createReleasePR({ owner, repo, version, releaseTitle, }) {
const gh = getClient();
const tagName = `v${version}`;
const branch = `release/${tagName}`;
const { data } = await gh.pulls.create({
owner,
repo,
head: branch,
base: 'master',
title: `Release ${tagName}: ${releaseTitle}`,
});
return data;
}

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.extractRepoNameFromURL = extractRepoNameFromURL;
function extractRepoNameFromURL(repoURL) {
try {
return repoURL.split('repos/')[1].split('/')[1];
} catch {
return repoURL.split('github.com/')[1].split('/')[1];
}
}
export function extractRepoNameFromURL(repoURL) {
try {
return repoURL.split('repos/')[1].split('/')[1];
}
catch {
return repoURL.split('github.com/')[1].split('/')[1];
}
}

@@ -1,22 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPR = getPR;
var _restClient = require("../rest-client");
async function getPR({
repo,
owner,
pr
}) {
const client = (0, _restClient.getClient)();
const {
data
} = await client.pulls.get({
repo,
owner,
pull_number: pr
});
return data;
}
import { getClient } from '../rest-client.js';
export async function getPR({ repo, owner, pr, }) {
const client = getClient();
const { data } = await client.pulls.get({ repo, owner, pull_number: pr });
return data;
}

@@ -1,6 +0,6 @@

export * from './approve';
export * from './create-release-pr';
export * from './extract-repo-name';
export * from './get-pr';
export * from './list-prs';
export * from './merge';
export * from './approve.js';
export * from './create-release-pr.js';
export * from './extract-repo-name.js';
export * from './get-pr.js';
export * from './list-prs.js';
export * from './merge.js';

@@ -1,71 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _approve = require("./approve");
Object.keys(_approve).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _approve[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _approve[key];
}
});
});
var _createReleasePr = require("./create-release-pr");
Object.keys(_createReleasePr).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _createReleasePr[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _createReleasePr[key];
}
});
});
var _extractRepoName = require("./extract-repo-name");
Object.keys(_extractRepoName).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _extractRepoName[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _extractRepoName[key];
}
});
});
var _getPr = require("./get-pr");
Object.keys(_getPr).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _getPr[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _getPr[key];
}
});
});
var _listPrs = require("./list-prs");
Object.keys(_listPrs).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _listPrs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _listPrs[key];
}
});
});
var _merge = require("./merge");
Object.keys(_merge).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _merge[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _merge[key];
}
});
});
export * from './approve.js';
export * from './create-release-pr.js';
export * from './extract-repo-name.js';
export * from './get-pr.js';
export * from './list-prs.js';
export * from './merge.js';

@@ -12,4 +12,581 @@ import type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';

export declare function listPrs(params: ListOpenPRsParams): ReturnType<typeof getPRs>;
export declare function getOpenRepoPRsFromHuman(owner: string, repo: string): Promise<any[]>;
export declare function getCommitChecks(owner: string, repo: string, commitRef: string): Promise<any[]>;
export declare function getOpenRepoPRsFromHuman(owner: string, repo: string): Promise<{
url: string;
id: number;
node_id: string;
html_url: string;
diff_url: string;
patch_url: string;
issue_url: string;
commits_url: string;
review_comments_url: string;
review_comment_url: string;
comments_url: string;
statuses_url: string;
number: number;
state: string;
locked: boolean;
title: string;
user: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
body: string | null;
labels: {
id: number;
node_id: string;
url: string;
name: string;
description: string;
color: string;
default: boolean;
}[];
milestone: {
url: string;
html_url: string;
labels_url: string;
id: number;
node_id: string;
number: number;
state: "open" | "closed";
title: string;
description: string | null;
creator: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
open_issues: number;
closed_issues: number;
created_at: string;
updated_at: string;
closed_at: string | null;
due_on: string | null;
} | null;
active_lock_reason?: string | null | undefined;
created_at: string;
updated_at: string;
closed_at: string | null;
merged_at: string | null;
merge_commit_sha: string | null;
assignee: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
assignees?: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
}[] | null | undefined;
requested_reviewers?: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
}[] | null | undefined;
requested_teams?: {
id: number;
node_id: string;
name: string;
slug: string;
description: string | null;
privacy?: string | undefined;
notification_setting?: string | undefined;
permission: string;
permissions?: {
pull: boolean;
triage: boolean;
push: boolean;
maintain: boolean;
admin: boolean;
} | undefined;
url: string;
html_url: string;
members_url: string;
repositories_url: string;
parent: {
id: number;
node_id: string;
url: string;
members_url: string;
name: string;
description: string | null;
permission: string;
privacy?: string | undefined;
notification_setting?: string | undefined;
html_url: string;
repositories_url: string;
slug: string;
ldap_dn?: string | undefined;
} | null;
}[] | null | undefined;
head: {
label: string;
ref: string;
repo: {
id: number;
node_id: string;
name: string;
full_name: string;
license: {
key: string;
name: string;
url: string | null;
spdx_id: string | null;
node_id: string;
html_url?: string | undefined;
} | null;
forks: number;
permissions?: {
admin: boolean;
pull: boolean;
triage?: boolean | undefined;
push: boolean;
maintain?: boolean | undefined;
} | undefined;
owner: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
};
private: boolean;
html_url: string;
description: string | null;
fork: boolean;
url: string;
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
downloads_url: string;
events_url: string;
forks_url: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
git_url: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
notifications_url: string;
pulls_url: string;
releases_url: string;
ssh_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
clone_url: string;
mirror_url: string | null;
hooks_url: string;
svn_url: string;
homepage: string | null;
language: string | null;
forks_count: number;
stargazers_count: number;
watchers_count: number;
size: number;
default_branch: string;
open_issues_count: number;
is_template?: boolean | undefined;
topics?: string[] | undefined;
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_downloads: boolean;
has_discussions?: boolean | undefined;
archived: boolean;
disabled: boolean;
visibility?: string | undefined;
pushed_at: string | null;
created_at: string | null;
updated_at: string | null;
allow_rebase_merge?: boolean | undefined;
temp_clone_token?: string | undefined;
allow_squash_merge?: boolean | undefined;
allow_auto_merge?: boolean | undefined;
delete_branch_on_merge?: boolean | undefined;
allow_update_branch?: boolean | undefined;
use_squash_pr_title_as_default?: boolean | undefined;
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE" | undefined;
merge_commit_message?: "PR_TITLE" | "PR_BODY" | "BLANK" | undefined;
allow_merge_commit?: boolean | undefined;
allow_forking?: boolean | undefined;
web_commit_signoff_required?: boolean | undefined;
open_issues: number;
watchers: number;
master_branch?: string | undefined;
starred_at?: string | undefined;
anonymous_access_enabled?: boolean | undefined;
};
sha: string;
user: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
};
base: {
label: string;
ref: string;
repo: {
id: number;
node_id: string;
name: string;
full_name: string;
license: {
key: string;
name: string;
url: string | null;
spdx_id: string | null;
node_id: string;
html_url?: string | undefined;
} | null;
forks: number;
permissions?: {
admin: boolean;
pull: boolean;
triage?: boolean | undefined;
push: boolean;
maintain?: boolean | undefined;
} | undefined;
owner: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
};
private: boolean;
html_url: string;
description: string | null;
fork: boolean;
url: string;
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
downloads_url: string;
events_url: string;
forks_url: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
git_url: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
notifications_url: string;
pulls_url: string;
releases_url: string;
ssh_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
clone_url: string;
mirror_url: string | null;
hooks_url: string;
svn_url: string;
homepage: string | null;
language: string | null;
forks_count: number;
stargazers_count: number;
watchers_count: number;
size: number;
default_branch: string;
open_issues_count: number;
is_template?: boolean | undefined;
topics?: string[] | undefined;
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_downloads: boolean;
has_discussions?: boolean | undefined;
archived: boolean;
disabled: boolean;
visibility?: string | undefined;
pushed_at: string | null;
created_at: string | null;
updated_at: string | null;
allow_rebase_merge?: boolean | undefined;
temp_clone_token?: string | undefined;
allow_squash_merge?: boolean | undefined;
allow_auto_merge?: boolean | undefined;
delete_branch_on_merge?: boolean | undefined;
allow_update_branch?: boolean | undefined;
use_squash_pr_title_as_default?: boolean | undefined;
squash_merge_commit_title?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
squash_merge_commit_message?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
merge_commit_title?: "PR_TITLE" | "MERGE_MESSAGE" | undefined;
merge_commit_message?: "PR_TITLE" | "PR_BODY" | "BLANK" | undefined;
allow_merge_commit?: boolean | undefined;
allow_forking?: boolean | undefined;
web_commit_signoff_required?: boolean | undefined;
open_issues: number;
watchers: number;
master_branch?: string | undefined;
starred_at?: string | undefined;
anonymous_access_enabled?: boolean | undefined;
};
sha: string;
user: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
};
_links: {
comments: {
href: string;
};
commits: {
href: string;
};
statuses: {
href: string;
};
html: {
href: string;
};
issue: {
href: string;
};
review_comments: {
href: string;
};
review_comment: {
href: string;
};
self: {
href: string;
};
};
author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
auto_merge: {
enabled_by: {
name?: string | null | undefined;
email?: string | null | undefined;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
};
merge_method: "merge" | "squash" | "rebase";
commit_title: string;
commit_message: string;
} | null;
draft?: boolean | undefined;
}[]>;
export declare function getCommitChecks(owner: string, repo: string, commitRef: string): Promise<any>;
export declare function getPRCommitRefsWithMessages(owner: string, repo: string, prNumber: number): Promise<{

@@ -16,0 +593,0 @@ sha: string;

@@ -1,89 +0,62 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCommitChecks = getCommitChecks;
exports.getOpenRepoPRsFromHuman = getOpenRepoPRsFromHuman;
exports.getPRCommitRefsWithMessages = getPRCommitRefsWithMessages;
exports.listClosedPRs = listClosedPRs;
exports.listPrs = listPrs;
var _restClient = require("../rest-client");
function listPrs(params) {
return getPRs({
...params,
prStatus: 'open'
});
import { getClient } from '../rest-client.js';
export function listPrs(params) {
return getPRs({ ...params, prStatus: 'open' });
}
async function getOpenRepoPRsFromHuman(owner, repo) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.pulls.list({
owner,
repo,
state: 'open'
});
return data.filter(pr => {
var _pr$user;
return !(pr !== null && pr !== void 0 && (_pr$user = pr.user) !== null && _pr$user !== void 0 && _pr$user.login.endsWith('[bot]')) && !pr.draft;
});
export async function getOpenRepoPRsFromHuman(owner, repo) {
const gh = getClient();
const { data } = await gh.pulls.list({
owner,
repo,
state: 'open',
});
return data.filter(pr => !pr?.user?.login.endsWith('[bot]') && !pr.draft);
}
async function getCommitChecks(owner, repo, commitRef) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.request({
method: 'GET',
url: `/repos/${owner}/${repo}/commits/${commitRef}/statuses`
});
return data;
export async function getCommitChecks(owner, repo, commitRef) {
const gh = getClient();
const { data } = await gh.request({
method: 'GET',
url: `/repos/${owner}/${repo}/commits/${commitRef}/statuses`,
});
return data;
}
async function getPRCommitRefsWithMessages(owner, repo, prNumber) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.pulls.listCommits({
owner,
repo,
pull_number: prNumber
});
return data.map(commit => {
return {
sha: commit.sha,
message: commit.commit.message
};
});
export async function getPRCommitRefsWithMessages(owner, repo, prNumber) {
const gh = getClient();
const { data } = await gh.pulls.listCommits({
owner,
repo,
pull_number: prNumber,
});
return data.map(commit => {
return {
sha: commit.sha,
message: commit.commit.message,
};
});
}
function listClosedPRs(params) {
return getPRs({
...params,
prStatus: 'closed'
});
export function listClosedPRs(params) {
return getPRs({ ...params, prStatus: 'closed' });
}
const prsGenerator = async function* (params) {
let pageNumber = 1;
let hasNextPage = true;
while (hasNextPage && pageNumber <= 10) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.search.issuesAndPullRequests({
per_page: 100,
page: pageNumber,
q: `is:${params.prStatus} is:pr archived:false user:${params.owner} ${params.searchText || ''}`
});
if (data.items.length < 100) {
hasNextPage = false;
let pageNumber = 1;
let hasNextPage = true;
while (hasNextPage && pageNumber <= 10) {
const gh = getClient();
const { data } = await gh.search.issuesAndPullRequests({
per_page: 100,
page: pageNumber,
q: `is:${params.prStatus} is:pr archived:false user:${params.owner} ${params.searchText || ''}`,
});
if (data.items.length < 100) {
hasNextPage = false;
}
pageNumber++;
yield data.items;
}
pageNumber++;
yield data.items;
}
};
async function getPRs(params) {
const prs = [];
for await (const prsOnePage of prsGenerator(params)) {
prs.push(...prsOnePage);
}
return prs;
}
const prs = [];
for await (const prsOnePage of prsGenerator(params)) {
prs.push(...prsOnePage);
}
return prs;
}

@@ -1,19 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mergePR = mergePR;
var _restClient = require("../rest-client");
async function mergePR(params) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.pulls.merge({
repo: params.repo,
pull_number: params.pr,
owner: params.owner,
merge_method: 'merge'
});
return data;
}
import { getClient } from '../rest-client.js';
export async function mergePR(params) {
const gh = getClient();
const { data } = await gh.pulls.merge({
repo: params.repo,
pull_number: params.pr,
owner: params.owner,
merge_method: 'merge',
});
return data;
}

@@ -1,25 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createReleaseBranch = createReleaseBranch;
var _restClient = require("../rest-client");
async function createReleaseBranch({
owner,
repo,
version,
sha
}) {
const gh = (0, _restClient.getClient)();
const branchName = `refs/heads/release/v${version}`;
const {
data
} = await gh.git.createRef({
owner,
repo,
ref: branchName,
sha
});
return data;
}
import { getClient } from '../rest-client.js';
export async function createReleaseBranch({ owner, repo, version, sha, }) {
const gh = getClient();
const branchName = `refs/heads/release/v${version}`;
const { data } = await gh.git.createRef({
owner,
repo,
ref: branchName,
sha,
});
return data;
}

@@ -1,30 +0,15 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.deleteBranch = deleteBranch;
var _restClient = require("../rest-client");
async function deleteBranch({
owner,
repo,
ref
}) {
const gh = (0, _restClient.getClient)();
try {
const {
data
} = await gh.git.deleteRef({
owner,
repo,
ref
});
return data;
} catch (error) {
if (error.status === 422) {
console.error(error.message, `(possibly branch auto-delete feature is enabled in the repo settings)`);
return;
import { getClient } from '../rest-client.js';
export async function deleteBranch({ owner, repo, ref, }) {
const gh = getClient();
try {
const { data } = await gh.git.deleteRef({ owner, repo, ref });
return data;
}
console.error(`Error deleting branch`, error);
}
}
catch (error) {
if (error.status === 422) {
console.error(error.message, `(possibly branch auto-delete feature is enabled in the repo settings)`);
return;
}
console.error(`Error deleting branch`, error);
}
}
import type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
import { getRepoBranch } from './get-repo-branches';
import { getRepoBranch } from './get-repo-branches.js';
type LatestBranchCommit = RestEndpointMethodTypes['repos']['getBranch']['response']['data']['commit'] | undefined;

@@ -4,0 +4,0 @@ export declare function getLatestBranchCommit({ owner, repo, branch, }: Parameters<typeof getRepoBranch>[0]): Promise<LatestBranchCommit>;

@@ -1,41 +0,20 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getLatestBranchCommit = getLatestBranchCommit;
exports.getLatestDevelopCommit = getLatestDevelopCommit;
exports.getLatestDevelopCommitSHA = getLatestDevelopCommitSHA;
var _getRepoBranches = require("./get-repo-branches");
async function getLatestBranchCommit({
owner,
repo,
branch
}) {
const branchResponse = await (0, _getRepoBranches.getRepoBranch)({
owner,
repo,
branch
});
return branchResponse === null || branchResponse === void 0 ? void 0 : branchResponse.commit;
import { getRepoBranch } from './get-repo-branches.js';
export async function getLatestBranchCommit({ owner, repo, branch, }) {
const branchResponse = await getRepoBranch({
owner,
repo,
branch,
});
return branchResponse?.commit;
}
function getLatestDevelopCommit({
owner,
repo
}) {
return getLatestBranchCommit({
owner,
repo,
branch: 'develop'
});
export function getLatestDevelopCommit({ owner, repo, }) {
return getLatestBranchCommit({
owner,
repo,
branch: 'develop',
});
}
async function getLatestDevelopCommitSHA({
owner,
repo
}) {
const commit = await getLatestDevelopCommit({
owner,
repo
});
return (commit === null || commit === void 0 ? void 0 : commit.sha) || '';
}
export async function getLatestDevelopCommitSHA({ owner, repo, }) {
const commit = await getLatestDevelopCommit({ owner, repo });
return commit?.sha || '';
}

@@ -1,44 +0,23 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRepoBranch = getRepoBranch;
exports.getRepoBranches = getRepoBranches;
exports.getRepoBranchesNames = getRepoBranchesNames;
var _restClient = require("../rest-client");
async function getRepoBranch({
owner,
repo,
branch
}) {
const gh = (0, _restClient.getClient)();
const branchResponse = await gh.repos.getBranch({
owner,
repo,
branch
});
return branchResponse.data;
import { getClient } from '../rest-client.js';
export async function getRepoBranch({ owner, repo, branch, }) {
const gh = getClient();
const branchResponse = await gh.repos.getBranch({
owner,
repo,
branch,
});
return branchResponse.data;
}
async function getRepoBranches({
owner,
repo
}) {
const gh = (0, _restClient.getClient)();
const branchesResponse = await gh.repos.listBranches({
owner,
repo,
per_page: 100
});
return branchesResponse.data;
export async function getRepoBranches({ owner, repo, }) {
const gh = getClient();
const branchesResponse = await gh.repos.listBranches({
owner,
repo,
per_page: 100,
});
return branchesResponse.data;
}
async function getRepoBranchesNames({
owner,
repo
}) {
const branchesResponse = await getRepoBranches({
owner,
repo
});
return (branchesResponse === null || branchesResponse === void 0 ? void 0 : branchesResponse.map(branch => branch === null || branch === void 0 ? void 0 : branch.name)) ?? [];
}
export async function getRepoBranchesNames({ owner, repo, }) {
const branchesResponse = await getRepoBranches({ owner, repo });
return branchesResponse?.map(branch => branch?.name) ?? [];
}

@@ -1,27 +0,14 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRepoMergeStrategies = getRepoMergeStrategies;
var _restClient = require("../rest-client");
/* eslint-disable camelcase */
async function getRepoMergeStrategies(owner, repo) {
const gh = (0, _restClient.getClient)();
const {
data: {
allow_merge_commit,
allow_squash_merge,
allow_rebase_merge
}
} = await gh.repos.get({
owner,
repo
});
return {
allowMergeCommit: allow_merge_commit,
allowSquashMerge: allow_squash_merge,
allowRebaseMerge: allow_rebase_merge
};
}
import { getClient } from '../rest-client.js';
export async function getRepoMergeStrategies(owner, repo) {
const gh = getClient();
const { data: { allow_merge_commit, allow_squash_merge, allow_rebase_merge }, } = await gh.repos.get({
owner,
repo,
});
return {
allowMergeCommit: allow_merge_commit,
allowSquashMerge: allow_squash_merge,
allowRebaseMerge: allow_rebase_merge,
};
}

@@ -1,8 +0,8 @@

export * from './create-release-branch';
export * from './delete-branch';
export * from './get-latest-branch-commit';
export * from './get-repo-branches';
export * from './get-repo-merge-strategies';
export * from './labels';
export * from './list-org-repos';
export * from './update-repo-merge-strategies';
export * from './create-release-branch.js';
export * from './delete-branch.js';
export * from './get-latest-branch-commit.js';
export * from './get-repo-branches.js';
export * from './get-repo-merge-strategies.js';
export * from './labels.js';
export * from './list-org-repos.js';
export * from './update-repo-merge-strategies.js';

@@ -1,93 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createReleaseBranch = require("./create-release-branch");
Object.keys(_createReleaseBranch).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _createReleaseBranch[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _createReleaseBranch[key];
}
});
});
var _deleteBranch = require("./delete-branch");
Object.keys(_deleteBranch).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _deleteBranch[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _deleteBranch[key];
}
});
});
var _getLatestBranchCommit = require("./get-latest-branch-commit");
Object.keys(_getLatestBranchCommit).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _getLatestBranchCommit[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _getLatestBranchCommit[key];
}
});
});
var _getRepoBranches = require("./get-repo-branches");
Object.keys(_getRepoBranches).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _getRepoBranches[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _getRepoBranches[key];
}
});
});
var _getRepoMergeStrategies = require("./get-repo-merge-strategies");
Object.keys(_getRepoMergeStrategies).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _getRepoMergeStrategies[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _getRepoMergeStrategies[key];
}
});
});
var _labels = require("./labels");
Object.keys(_labels).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _labels[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _labels[key];
}
});
});
var _listOrgRepos = require("./list-org-repos");
Object.keys(_listOrgRepos).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _listOrgRepos[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _listOrgRepos[key];
}
});
});
var _updateRepoMergeStrategies = require("./update-repo-merge-strategies");
Object.keys(_updateRepoMergeStrategies).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _updateRepoMergeStrategies[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _updateRepoMergeStrategies[key];
}
});
});
export * from './create-release-branch.js';
export * from './delete-branch.js';
export * from './get-latest-branch-commit.js';
export * from './get-repo-branches.js';
export * from './get-repo-merge-strategies.js';
export * from './labels.js';
export * from './list-org-repos.js';
export * from './update-repo-merge-strategies.js';

@@ -1,44 +0,30 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.assignReleaseLabelToPR = assignReleaseLabelToPR;
exports.createReleaseLabel = createReleaseLabel;
exports.getRepoLabels = getRepoLabels;
var _restClient = require("../rest-client");
async function getRepoLabels(owner, repo) {
const client = (0, _restClient.getClient)();
const {
data
} = await client.issues.listLabelsForRepo({
owner,
repo
});
return data.map(l => l.name);
import { getClient } from '../rest-client.js';
export async function getRepoLabels(owner, repo) {
const client = getClient();
const { data } = await client.issues.listLabelsForRepo({
owner,
repo,
});
return data.map(l => l.name);
}
async function createReleaseLabel(owner, repo) {
const client = (0, _restClient.getClient)();
try {
await client.issues.createLabel({
owner,
repo,
name: 'release',
color: 'ff0000'
});
} catch (error) {
if (error.errors.some(e => e.code === 'already_exists')) {
return;
export async function createReleaseLabel(owner, repo) {
const client = getClient();
try {
await client.issues.createLabel({ owner, repo, name: 'release', color: 'ff0000' });
}
throw error;
}
catch (error) {
if (error.errors.some((e) => e.code === 'already_exists')) {
return;
}
throw error;
}
}
async function assignReleaseLabelToPR(owner, repo, pullNumber) {
const client = (0, _restClient.getClient)();
await client.issues.addLabels({
owner,
repo,
issue_number: pullNumber,
labels: ['release']
});
}
export async function assignReleaseLabelToPR(owner, repo, pullNumber) {
const client = getClient();
await client.issues.addLabels({
owner,
repo,
issue_number: pullNumber,
labels: ['release'],
});
}

@@ -1,45 +0,33 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.listOrgRepos = listOrgRepos;
var _restClient = require("../rest-client");
async function listOrgRepos(params) {
const {
org,
type = 'all',
skipArchived = false
} = params;
let page = 1;
let hasMore = false;
const repos = [];
do {
const data = await list(org, page, type);
hasMore = data.length === 100;
page++;
repos.push(...data);
} while (hasMore);
return repos.filter(repo => {
if (skipArchived) {
if (repo.archived) {
return false;
}
}
return true;
});
import { getClient } from '../rest-client.js';
export async function listOrgRepos(params) {
const { org, type = 'all', skipArchived = false } = params;
let page = 1;
let hasMore = false;
const repos = [];
do {
const data = await list(org, page, type);
hasMore = data.length === 100;
page++;
repos.push(...data);
} while (hasMore);
return repos.filter(repo => {
if (skipArchived) {
if (repo.archived) {
return false;
}
}
return true;
});
}
async function list(org, page, type) {
const gh = (0, _restClient.getClient)();
const {
data
} = await gh.repos.listForOrg({
org,
type,
sort: 'pushed',
per_page: 100,
page,
direction: 'desc'
});
return data;
}
const gh = getClient();
const { data } = await gh.repos.listForOrg({
org,
type,
sort: 'pushed',
per_page: 100,
page,
direction: 'desc',
});
return data;
}

@@ -1,26 +0,13 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.updateRepoMergeStrategies = updateRepoMergeStrategies;
var _restClient = require("../rest-client");
/* eslint-disable camelcase */
async function updateRepoMergeStrategies(params) {
const gh = (0, _restClient.getClient)();
const {
owner,
repo,
allowMergeCommits,
allowSquash,
allowRebase
} = params;
await gh.repos.update({
owner,
repo,
allow_merge_commit: allowMergeCommits,
allow_squash_merge: allowSquash,
allow_rebase_merge: allowRebase
});
}
import { getClient } from '../rest-client.js';
export async function updateRepoMergeStrategies(params) {
const gh = getClient();
const { owner, repo, allowMergeCommits, allowSquash, allowRebase } = params;
await gh.repos.update({
owner,
repo,
allow_merge_commit: allowMergeCommits,
allow_squash_merge: allowSquash,
allow_rebase_merge: allowRebase,
});
}

@@ -1,17 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getClient = getClient;
var _rest = require("@octokit/rest");
let client;
function getClient() {
if (client) {
return client;
}
client = new _rest.Octokit({
auth: process.env.GITHUB_TOKEN
});
return client;
}
import { Octokit } from '@octokit/rest';
export function getClient() {
return new Octokit({
auth: process.env.GITHUB_TOKEN,
});
}
{
"name": "@shelf/gh-sdk",
"version": "1.1.0",
"version": "2.0.0",
"description": "Convenient wrapper for GitHub API for automation tasks",

@@ -11,3 +11,4 @@ "license": "MIT",

},
"main": "lib",
"type": "module",
"exports": "./lib/index.js",
"types": "lib/index.d.ts",

@@ -18,5 +19,3 @@ "files": [

"scripts": {
"build": "rm -rf lib/ && yarn build:types && yarn build:code",
"build:code": "babel src --out-dir lib --ignore '**/*.test.ts' --extensions '.ts' && find ./lib -name '*.test.d.ts' -delete",
"build:types": "tsc --emitDeclarationOnly --declaration --isolatedModules false --declarationDir lib",
"build": "rm -rf lib/ && tsc",
"coverage": "jest --coverage",

@@ -30,42 +29,30 @@ "lint": "eslint . --ext .js,.ts,.json --fix",

},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{html,json,md,yml}": [
"prettier --write"
],
"*.{js,ts}": [
"eslint --fix"
]
"*.{html,json,md,yml}": "prettier --write",
"*.{js,ts}": "eslint --fix"
},
"babel": {
"extends": "@shelf/babel-config/backend"
},
"prettier": "@shelf/prettier-config",
"dependencies": {
"@octokit/rest": "19.0.5",
"@octokit/rest": "20.1.0",
"lodash": "4.17.21"
},
"devDependencies": {
"@babel/cli": "7.19.3",
"@babel/core": "7.21.4",
"@shelf/babel-config": "1.2.0",
"@shelf/eslint-config": "2.26.0",
"@shelf/eslint-config": "3.15.1",
"@shelf/prettier-config": "1.0.0",
"@shelf/tsconfig": "0.0.9",
"@types/jest": "29.5.1",
"@types/lodash": "4.14.194",
"@types/node": "16",
"eslint": "8.40.0",
"husky": "8.0.2",
"jest": "29.5.0",
"lint-staged": "13.2.2",
"prettier": "2.8.8",
"typescript": "4.9.5"
"@shelf/tsconfig": "0.1.0",
"@swc/core": "1.4.14",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
"@types/lodash": "4.17.0",
"@types/node": "20.12.7",
"eslint": "8.56.0",
"husky": "9.0.11",
"jest": "29.7.0",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"ts-jest-resolver": "2.0.1",
"typescript": "5.4.5"
},
"engines": {
"node": ">=16"
"node": ">=18"
},

@@ -72,0 +59,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc