Skip to content

Commit

Permalink
fix: improve user feedback
Browse files Browse the repository at this point in the history
When PaC is used with other CIs (eg openshift-ci), it can happen that a
`ok-to-test` label managed by the other CI is present. That label may
persist after a change, but PaC will report the need for the latest
content to be approved. This state is likely to confuse the user.

In order to improve the UX, the required action is now explicitely
stated in the message in the UI.
  • Loading branch information
Roming22 authored and chmouel committed Dec 20, 2024
1 parent 3042980 commit 5899d80
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/pipelineascode/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (p *PacRun) checkAccessOrErrror(ctx context.Context, repo *v1alpha1.Reposit
p.eventEmitter.EmitMessage(repo, zap.InfoLevel, "RepositoryPermissionDenied", msg)
status := provider.StatusOpts{
Status: queuedStatus,
Title: "Pending approval",
Title: "Pending approval, needs /ok-to-test",
Conclusion: pendingConclusion,
Text: msg,
DetailsURL: p.event.URL,
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/github/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (v *Provider) createStatusCommit(ctx context.Context, runevent *info.Event,
runevent.Organization, runevent.Repository, runevent.SHA, ghstatus); err != nil {
return err
}
if (status.Status == "completed" || (status.Status == "queued" && status.Title == "Pending approval")) && status.Text != "" && runevent.EventType == triggertype.PullRequest.String() {
if (status.Status == "completed" || (status.Status == "queued" && status.Title == "Pending approval, needs /ok-to-test")) && status.Text != "" && runevent.EventType == triggertype.PullRequest.String() {
_, _, err = v.Client.Issues.CreateComment(ctx, runevent.Organization, runevent.Repository,
runevent.PullRequestNumber,
&github.IssueComment{
Expand Down
4 changes: 2 additions & 2 deletions pkg/provider/github/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestGetExistingPendingApprovalCheckRunID(t *testing.T) {
"id": %v,
"external_id": "%s",
"output": {
"title": "Pending approval",
"title": "Pending approval, needs /ok-to-test",
"summary": "My CI is waiting for approval"
}
}
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestGithubProviderCreateStatus(t *testing.T) {
"status": "queued",
"conclusion": "pending",
"output": {
"title": "Pending approval",
"title": "Pending approval, needs /ok-to-test",
"summary": "My CI is waiting for approval"
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/pkg/gitea/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func WaitForStatus(t *testing.T, topts *TestOpts, ref, forcontext string, onlyla
}
for _, cstatus := range statuses {
if topts.CheckForStatus == "Skipped" {
if strings.HasSuffix(cstatus.Description, "Pending approval") {
if strings.HasSuffix(cstatus.Description, "Pending approval, needs /ok-to-test") {
numstatus++
break
}
Expand Down

0 comments on commit 5899d80

Please sign in to comment.