Skip to content

Commit

Permalink
fix: handle undefined organization in response
Browse files Browse the repository at this point in the history
  • Loading branch information
fpicalausa committed Jun 3, 2022
1 parent 95af702 commit 3a1c768
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31548,6 +31548,7 @@ const GRAPHQL_QUERY_WITH_ORG = `query ($repo: String!, $owner: String!, $organiz
}
}`;
function readBranches(octokit, headers, repo, organization) {
var _a;
return __asyncGenerator(this, arguments, function* readBranches_1() {
let pagination = { hasNextPage: true, endCursor: null };
while (pagination.hasNextPage) {
Expand All @@ -31558,7 +31559,7 @@ function readBranches(octokit, headers, repo, organization) {
const ref = edges[i];
const { node: { branchName, prefix, refUpdateRule, target: { oid, author: { date, user }, }, }, } = ref;
const login = user ? user.login : null;
const organization = user ? user.organization.id : null;
const organization = (_a = user === null || user === void 0 ? void 0 : user.organization) === null || _a === void 0 ? void 0 : _a.id;
yield yield __await({
date: Date.parse(date),
branchName,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "remove-stale-branches",
"private": true,
"version": "1.5.4",
"version": "1.5.6",
"description": "Cleanup stale branches from a repository",
"main": "src/index.ts",
"author": "Francois Picalausa <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/readBranches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export async function* readBranches(
} = ref;

const login = user ? user.login : null;
const organization = user ? user.organization.id : null;
const organization = user?.organization?.id;
yield {
date: Date.parse(date),
branchName,
Expand Down

0 comments on commit 3a1c768

Please sign in to comment.