Documentation ¶
Overview ¶
Package cienv provides utility for environment variable in CI services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasReadOnlyPermissionGitHubToken ¶
func HasReadOnlyPermissionGitHubToken() bool
HasReadOnlyPermissionGitHubToken returns true if reviewdog is running in GitHub Actions and running for PullRequests from forked repository with read-only token. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target
func IsInBitbucketPipe ¶
func IsInBitbucketPipe() bool
IsInBitbucketPipe returns true if reviewdog is running in a Bitbucket Pipe.
func IsInBitbucketPipeline ¶
func IsInBitbucketPipeline() bool
IsInBitbucketPipeline returns true if reviewdog is running in Bitbucket Pipelines.
func IsInGitHubAction ¶
func IsInGitHubAction() bool
IsInGitHubAction returns true if reviewdog is running in GitHub Actions.
Types ¶
type BuildInfo ¶
type BuildInfo struct { Owner string Repo string SHA string // Optional. PullRequest int // MergeRequest for GitLab. // Optional. Branch string // Gerrit related params GerritChangeID string GerritRevisionID string }
BuildInfo represents build information about GitHub or GitLab project.
func GetBuildInfo ¶
GetBuildInfo returns BuildInfo from environment variables.
Supported CI services' documents: - Travis CI: https://docs.travis-ci.com/user/environment-variables/ - Circle CI: https://circleci.com/docs/environment-variables/ - Drone.io: http://docs.drone.io/environment-reference/ - GitLab CI: https://docs.gitlab.com/ee/ci/variables/#predefined-variables-environment-variables - GitLab CI doesn't export ID of Merge Request. https://gitlab.com/gitlab-org/gitlab-ce/issues/15280
func GetGerritBuildInfo ¶
GetGerritBuildInfo returns Gerrit specific build info
type GitHubEvent ¶
type GitHubEvent struct { PullRequest GitHubPullRequest `json:"pull_request"` Repository struct { Owner struct { Login string `json:"login"` } `json:"owner"` Name string `json:"name"` } `json:"repository"` CheckSuite struct { After string `json:"after"` PullRequests []GitHubPullRequest `json:"pull_requests"` } `json:"check_suite"` HeadCommit struct { ID string `json:"id"` } `json:"head_commit"` ActionName string `json:"-"` // this is defined as env GITHUB_EVENT_NAME }
https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
func LoadGitHubEvent ¶
func LoadGitHubEvent() (*GitHubEvent, error)
LoadGitHubEvent loads GitHubEvent if it's running in GitHub Actions.
type GitHubPullRequest ¶
type GitHubPullRequest struct { Number int `json:"number"` Head struct { Sha string `json:"sha"` Ref string `json:"ref"` Repo GitHubRepo `json:"repo"` } `json:"head"` Base struct { Repo GitHubRepo `json:"repo"` } `json:"base"` }
type GitHubRepo ¶
type GitHubRepo struct { Owner struct { ID int64 `json:"id"` } }