Skip to content

Commit

Permalink
Merge pull request #45 from grafana/armandgrillet/new-labels-option
Browse files Browse the repository at this point in the history
Allow input of the labels
  • Loading branch information
armandgrillet authored Aug 9, 2024
2 parents 87a42c9 + 7bda6a2 commit c1dcc3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/ic-assignment/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ func main() {

dryRun := githubaction.GetInputOrDefault("dry-run", "true") != "false"

labelsList := githubaction.GetInputOrDefault("labels", "")

action := &icassigner.Action{
Client: client,
Config: cfg,
}

err = action.Run(ctx, actionCtx, dryRun)
err = action.Run(ctx, actionCtx, labelsList, dryRun)
if err != nil {
log.Fatalf("Unable to run action: %v", err)
}
Expand Down
4 changes: 4 additions & 0 deletions ic-assignment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: "With this option the decision only gets logged, but not change is made to the issue."
required: false
default: "true"
labels:
description: "With this option, the labels provided as a comma separated list will be the one used instead of the one in the issue."
required: false
default: ""
gcal-service-acount-key:
description: "Used to access google calendars in case of being configured for team members"
required: false
Expand Down
5 changes: 4 additions & 1 deletion pkg/icassigner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ type Action struct {
Config Config
}

func (a *Action) Run(ctx context.Context, event *github.IssuesEvent, dryRun bool) error {
func (a *Action) Run(ctx context.Context, event *github.IssuesEvent, labelsInput string, dryRun bool) error {
labels := convertLabels(event.Issue.Labels)
if labelsInput != "" {
labels = strings.Split(labelsInput, ",")
}

for _, i := range a.Config.IgnoredLabels {
for _, l := range labels {
Expand Down

0 comments on commit c1dcc3b

Please sign in to comment.