Skip to content

Commit

Permalink
rename to branchRulesetChecks()
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantBirki committed Dec 12, 2024
1 parent d8ab95b commit 6a65a3b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions __tests__/functions/branch-protection-checks.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {branchProtectionChecks} from '../../src/functions/branch-protection-checks'
import {branchRulesetChecks} from '../../src/functions/branch-ruleset-checks'
import * as core from '@actions/core'
import {COLORS} from '../../src/functions/colors'
import {SUGGESTED_RULESETS} from '../../src/functions/suggested-rulesets'
Expand Down Expand Up @@ -85,7 +85,7 @@ test('finds that no branch protections or rulesets are defined', async () => {
}
}
}
expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: false,
failed_checks: ['missing_branch_rulesets']
})
Expand All @@ -96,7 +96,7 @@ test('finds that no branch protections or rulesets are defined', async () => {

test('exits early if the user has disabled security warnings', async () => {
data.use_security_warnings = false
expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: true
})
expect(warningMock).not.toHaveBeenCalled()
Expand All @@ -116,7 +116,7 @@ test('finds that the branch ruleset is missing the deletion rule', async () => {
}
}

expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: false,
failed_checks: ['missing_deletion']
})
Expand Down Expand Up @@ -147,7 +147,7 @@ test('finds that the branch ruleset is missing the dismiss_stale_reviews_on_push
}
}

expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: false,
failed_checks: ['mismatch_pull_request_dismiss_stale_reviews_on_push']
})
Expand All @@ -172,7 +172,7 @@ test('finds that all suggested branch rulesets are defined', async () => {
}
}

expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: true,
failed_checks: []
})
Expand Down Expand Up @@ -211,7 +211,7 @@ test('finds that all suggested branch rulesets are defined but required reviews
}
}

expect(await branchProtectionChecks(context, octokit, data)).toStrictEqual({
expect(await branchRulesetChecks(context, octokit, data)).toStrictEqual({
success: false,
failed_checks: ['mismatch_pull_request_required_approving_review_count']
})
Expand Down
4 changes: 2 additions & 2 deletions __tests__/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {run} from '../src/main'
import * as reactEmote from '../src/functions/react-emote'
import * as contextCheck from '../src/functions/context-check'
import * as prechecks from '../src/functions/prechecks'
import * as branchProtectionChecks from '../src/functions/branch-protection-checks'
import * as branchRulesetChecks from '../src/functions/branch-ruleset-checks'
import * as help from '../src/functions/help'
import * as validPermissions from '../src/functions/valid-permissions'
import * as identicalCommitCheck from '../src/functions/identical-commit-check'
Expand Down Expand Up @@ -166,7 +166,7 @@ beforeEach(() => {
}
})
jest
.spyOn(branchProtectionChecks, 'branchProtectionChecks')
.spyOn(branchRulesetChecks, 'branchRulesetChecks')
.mockImplementation(() => {
return undefined
})
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {COLORS} from './colors'
import {API_HEADERS} from './api-headers'
import {SUGGESTED_RULESETS} from './suggested-rulesets'

export async function branchProtectionChecks(context, octokit, data) {
export async function branchRulesetChecks(context, octokit, data) {
const branch = data.branch
const use_security_warnings = data?.use_security_warnings !== false

Expand Down
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {actionStatus} from './functions/action-status'
import {createDeploymentStatus} from './functions/deployment'
import {isDeprecated} from './functions/deprecated-checks'
import {prechecks} from './functions/prechecks'
import {branchProtectionChecks} from './functions/branch-protection-checks'
import {branchRulesetChecks} from './functions/branch-ruleset-checks'
import {validPermissions} from './functions/valid-permissions'
import {lock} from './functions/lock'
import {unlock} from './functions/unlock'
Expand Down Expand Up @@ -450,8 +450,8 @@ export async function run() {
return 'failure'
}

// run branch protection checks
await branchProtectionChecks(context, octokit, {
// run branch ruleset checks
await branchRulesetChecks(context, octokit, {
branch: inputs.stable_branch,
use_security_warnings: inputs.use_security_warnings
})
Expand Down

0 comments on commit 6a65a3b

Please sign in to comment.