abcxyz / guardian

Apache License 2.0
17 stars 1 forks source link

Add UserAccessLevel in GetPolicyData result #417

Closed gjonathanhong closed 3 weeks ago

gjonathanhong commented 3 weeks ago

This change adds GetUserRepoPermissions to the Platform interface, which adds the user's access level for a repository as additional context in policy evaluations. This also changes platform.GetPolicyData() to skip fetching Pull Request Approvers if a pull request number is not provided.

{
  github: {
    pull_request_approvers: {
      // ...
    },
    user_access_level: "admin",
  }
}
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱

Guardian will run for the following directories

Directories terraform/project1 terraform/project2

github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 PLAN 🟩 SUCCESS [logs]

Entrypoint: terraform/project1

Details ```diff Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # null_resource.empty will be created + resource "null_resource" "empty" { + id = (known after apply) } Plan: 1 to add, 0 to change, 0 to destroy. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 PLAN 🟩 SUCCESS [logs]

Entrypoint: terraform/project2

Details ```diff Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # null_resource.empty will be created + resource "null_resource" "empty" { + id = (known after apply) } Plan: 1 to add, 0 to change, 0 to destroy. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 APPLY 🟩 SUCCESS [logs]

Entrypoint: terraform/project1

Details ```diff null_resource.empty: Creating... null_resource.empty: Creation complete after 0s [id=1924186028648777377] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ```
github-actions[bot] commented 3 weeks ago

🔱 Guardian 🔱 APPLY 🟩 SUCCESS [logs]

Entrypoint: terraform/project2

Details ```diff null_resource.empty: Creating... null_resource.empty: Creation complete after 0s [id=3113402193932852676] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ```