Skip to content

Commit

Permalink
Merge pull request #18 from dcodx/bug/protected_branches_missing
Browse files Browse the repository at this point in the history
added check for protected branches obj
  • Loading branch information
theztefan authored May 15, 2024
2 parents cea81f3 + 45a53f0 commit 51354c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/evaluators/RepoPolicyEvaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RepoPolicyEvaluator {
this.repositoryData = await (0, Repositories_1.getRepository)(this.repository.owner, this.repository.name);
Logger_1.logger.debug("Repository policy for repo: " + this.repository.name);
// Check the branch protection policy rule
if (this.policy.protected_branches.length > 0) {
if (this.policy.protected_branches && this.policy.protected_branches.length > 0) {
const branch_protection = new BranchProtectionChecks_1.BranchProtectionChecks(this.policy, this.repository);
const branch_protection_results = await branch_protection.checkBranchProtection();
Logger_1.logger.debug(`Branch protection rule results: ${JSON.stringify(branch_protection_results, null, 2)}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47897,7 +47897,7 @@ class RepoPolicyEvaluator {
this.repositoryData = await (0, Repositories_1.getRepository)(this.repository.owner, this.repository.name);
Logger_1.logger.debug("Repository policy for repo: " + this.repository.name);
// Check the branch protection policy rule
if (this.policy.protected_branches.length > 0) {
if (this.policy.protected_branches && this.policy.protected_branches.length > 0) {
const branch_protection = new BranchProtectionChecks_1.BranchProtectionChecks(this.policy, this.repository);
const branch_protection_results = await branch_protection.checkBranchProtection();
Logger_1.logger.debug(`Branch protection rule results: ${JSON.stringify(branch_protection_results, null, 2)}`);
Expand Down
2 changes: 1 addition & 1 deletion src/evaluators/RepoPolicyEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class RepoPolicyEvaluator {

logger.debug("Repository policy for repo: " + this.repository.name);
// Check the branch protection policy rule
if (this.policy.protected_branches.length > 0) {
if (this.policy.protected_branches && this.policy.protected_branches.length > 0) {
const branch_protection = new BranchProtectionChecks(
this.policy,
this.repository,
Expand Down

0 comments on commit 51354c0

Please sign in to comment.