diff --git a/app/api/controller/pullreq/merge.go b/app/api/controller/pullreq/merge.go index b41eb67e3..c0f7dad1e 100644 --- a/app/api/controller/pullreq/merge.go +++ b/app/api/controller/pullreq/merge.go @@ -568,6 +568,12 @@ func (c *Controller) Merge( audit.BypassedResourceTypePullRequest, audit.BypassedResourceName, strconv.FormatInt(pr.Number, 10), + audit.ResourceName, + fmt.Sprintf( + audit.BypassPullReqLabelFormat, + sourceRepo.Identifier, + strconv.FormatInt(pr.Number, 10), + ), audit.BypassAction, audit.BypassActionMerged, ), diff --git a/app/api/controller/repo/commit.go b/app/api/controller/repo/commit.go index ebd591bfc..a5416f6f2 100644 --- a/app/api/controller/repo/commit.go +++ b/app/api/controller/repo/commit.go @@ -174,6 +174,11 @@ func (c *Controller) CommitFiles(ctx context.Context, audit.BypassedResourceTypeCommit, audit.BypassedResourceName, commit.CommitID.String(), + fmt.Sprintf( + audit.BypassSHALabelFormat, + repo.Identifier, + commit.CommitID.String()[0:6], + ), ), audit.ActionBypassed, paths.Parent(repo.Path), diff --git a/app/api/controller/repo/create_branch.go b/app/api/controller/repo/create_branch.go index 3893f585a..d7497bd6e 100644 --- a/app/api/controller/repo/create_branch.go +++ b/app/api/controller/repo/create_branch.go @@ -123,6 +123,12 @@ func (c *Controller) CreateBranch(ctx context.Context, branch.Name, audit.BypassAction, audit.BypassActionCreated, + audit.ResourceName, + fmt.Sprintf( + audit.BypassSHALabelFormat, + repo.Identifier, + branch.Name, + ), ), audit.ActionBypassed, paths.Parent(repo.Path), diff --git a/app/api/controller/repo/delete_branch.go b/app/api/controller/repo/delete_branch.go index 84a65f65d..69b400612 100644 --- a/app/api/controller/repo/delete_branch.go +++ b/app/api/controller/repo/delete_branch.go @@ -110,6 +110,12 @@ func (c *Controller) DeleteBranch(ctx context.Context, branchName, audit.BypassAction, audit.BypassActionDeleted, + audit.ResourceName, + fmt.Sprintf( + audit.BypassSHALabelFormat, + repo.Identifier, + branchName, + ), ), audit.ActionBypassed, paths.Parent(repo.Path), diff --git a/audit/audit.go b/audit/audit.go index 326c44357..8977dca72 100644 --- a/audit/audit.go +++ b/audit/audit.go @@ -31,6 +31,7 @@ var ( ) const ( + ResourceName = "resourceName" RepoName = "repoName" BypassedResourceType = "bypassedResourceType" BypassedResourceName = "bypassedResourceName" @@ -43,6 +44,8 @@ const ( BypassActionCreated = "created" BypassActionCommitted = "committed" BypassActionMerged = "merged" + BypassSHALabelFormat = "%s @%s" + BypassPullReqLabelFormat = "%s #%s" ) type Action string