Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
aeddi committed Nov 28, 2024
1 parent fbd928a commit 0a8c66d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions contribs/github-bot/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"bytes"
"errors"
"fmt"
"github-bot/internal/client"
"github-bot/internal/utils"
"regexp"
"strings"
"text/template"

"github-bot/internal/client"
"github-bot/internal/utils"

"github.com/google/go-github/v64/github"
"github.com/sethvargo/go-githubactions"
)
Expand Down Expand Up @@ -175,9 +174,9 @@ func handleCommentUpdate(gh *client.GitHub, actionCtx *githubactions.GitHubConte

// If teams specified in rule, check if actor is a member of one of them.
if len(teams) > 0 {
if gh.IsUserInTeams(actionCtx.Actor, teams) {
if !gh.IsUserInTeams(actionCtx.Actor, teams) { // If user not allowed
if !gh.DryRun {
gh.SetBotComment(previous, int(prNum))
gh.SetBotComment(previous, int(prNum)) // Restore previous state
}
return errors.New("checkbox edited by a user not allowed to")
}
Expand Down
4 changes: 2 additions & 2 deletions contribs/github-bot/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"errors"
"fmt"
"github-bot/internal/logger"
"os"

"github-bot/internal/logger"
p "github-bot/internal/params"

"github.com/google/go-github/v64/github"
Expand Down Expand Up @@ -80,7 +80,7 @@ func (gh *GitHub) GetBotComment(prNum int) (*github.IssueComment, error) {
opts.Page = response.NextPage
}

return nil, errors.New("bot comment not found")
return nil, ErrBotCommentNotFound
}

// SetBotComment creates a bot's comment on the provided PR number
Expand Down

0 comments on commit 0a8c66d

Please sign in to comment.