Files
atlantis/server/events/command/context.go
Ross Strickland 434bab5c70 [Feature] - Add clear policy approval functionality. (#3351)
* Add clear policy approval functionality.

* Fix param name, update doc.

* fix test, add e2e test

* empty commit to re-trigger tests.

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-05-02 11:02:04 -04:00

47 lines
1.3 KiB
Go

package command
import (
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/logging"
"github.com/uber-go/tally"
)
// Trigger represents the how the command was triggered
type Trigger int
const (
// Commands that are automatically triggered (ie. automatic plans)
AutoTrigger Trigger = iota
// Commands that are triggered by comments (ie. atlantis plan)
CommentTrigger
)
// Context represents the context of a command that should be executed
// for a pull request.
type Context struct {
// HeadRepo is the repository that is getting merged into the BaseRepo.
// If the pull request branch is from the same repository then HeadRepo will
// be the same as BaseRepo.
// See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges
HeadRepo models.Repo
Pull models.PullRequest
Scope tally.Scope
// User is the user that triggered this command.
User models.User
Log logging.SimpleLogging
// Current PR state
PullRequestStatus models.PullReqStatus
PullStatus *models.PullStatus
// PolicySet is the policy set to target (if specified) for the approve_policies command.
PolicySet string
// ClearPolicyApproval is true if approval should be cleared on specified policies.
ClearPolicyApproval bool
Trigger Trigger
}