Skip to content

Commit e1c3580

Browse files
authored
Add env variable config for force shared policy option (#1095)
1 parent c34b63f commit e1c3580

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ curl: (22) The requested URL returned error: 422
738738

739739
It can be useful to simulate how Policy Bot would evaluate a pull request if certain conditions were changed. For example: adding a review from a specific user or group, or adjusting the base branch.
740740

741-
An API endpoint exists at `api/simulate/:org/:repo/:prNumber` to simiulate the result of a pull request. Simulations using this endpoint will NOT write the result back to the pull request status check and will instead return the result.
741+
An API endpoint exists at `api/simulate/:org/:repo/:prNumber` to simulate the result of a pull request. Simulations using this endpoint will NOT write the result back to the pull request status check and will instead return the result.
742742

743743
This API requires a GitHub token be passed as a bearer token. The token must have the ability to read the pull request the simulation is being run against.
744744

@@ -831,7 +831,7 @@ use a previous, non-dismissed review, if it exists, when evaluating rules.
831831

832832
For example, if a user leaves an "approval" review and follows up with a
833833
"request changes" review, `policy-bot` will use the "request changes" review
834-
when evaluating rules. However, if the user then dimisses their "request
834+
when evaluating rules. However, if the user then dismisses their "request
835835
changes" review, `policy-bot` will instead use the initial "approval" review in
836836
evaluating any rules.
837837

@@ -926,7 +926,7 @@ from the set.
926926

927927
#### Invalidating Approval on Push <!-- omit in toc -->
928928

929-
By default, `policy-bot` does not invalidate exisitng approvals when users add
929+
By default, `policy-bot` does not invalidate existing approvals when users add
930930
new commits to a pull request. You can control this behavior for each rule in a
931931
policy using the `invalidate_on_push` option.
932932

@@ -955,7 +955,7 @@ in mid-2023 because computing it was unreliable and inaccurate (see issue
955955
#### Expanding Required Reviewers <!-- omit in toc -->
956956

957957
The details view for a pull request shows the users, organizations, teams, and
958-
permission levels that are reqired to approve each rule. When the
958+
permission levels that are required to approve each rule. When the
959959
`options.expand_required_reviewers` server option is set, `policy-bot` expands
960960
these to show the list of users whose approval will satisfy each rule. This can
961961
make it easier for developers to figure out who they should ask for approval.

config/policy-bot.example.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ sessions:
127127
# # Can also be set by the POLICYBOT_OPTIONS_EXPAND_REQUIRED_REVIEWERS
128128
# # environment variable.
129129
# expand_required_reviewers: false
130+
#
131+
# # If true, forces the use of the shared repository policy for all repositories,
132+
# # even if they define their own local policy file.
133+
# # Can also be set by the POLICYBOT_OPTIONS_FORCE_SHARED_POLICY
134+
# # environment variable.
135+
# force_shared_policy: false
130136

131137
# Options for locating the frontend files. By default, the server uses appropriate
132138
# paths for the binary distribution and Docker container. For local development,

server/handler/eval_options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func (p *PullEvaluationOptions) SetValuesFromEnv(prefix string) {
103103
setStringPtrFromEnv("SHARED_REPOSITORY", prefix, &p.SharedRepository)
104104
setStringPtrFromEnv("SHARED_POLICY_PATH", prefix, &p.SharedPolicyPath)
105105
setStringFromEnv("STATUS_CHECK_CONTEXT", prefix, &p.StatusCheckContext)
106+
setBoolFromEnv("FORCE_SHARED_POLICY", prefix, &p.ForceSharedPolicy)
106107
setBoolFromEnv("EXPAND_REQUIRED_REVIEWERS", prefix, &p.ExpandRequiredReviewers)
107108
setBoolFromEnv("STRICT_REVIEW_DISMISSAL", prefix, &p.StrictReviewDismissal)
108109
setBoolFromEnv("POST_INSECURE_STATUS_CHECKS", prefix, &p.PostInsecureStatusChecks)

0 commit comments

Comments
 (0)