Skip to content

Commit

Permalink
Allow input of the labels
Browse files Browse the repository at this point in the history
  • Loading branch information
armandgrillet committed Aug 9, 2024
1 parent aa440d3 commit 3bcf252
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 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
Binary file added cmd/regex-labeler/regex-labeler
Binary file not shown.
6 changes: 5 additions & 1 deletion 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 All @@ -21,4 +25,4 @@ outputs:
description: "The output property of the assigned person. If output property is empty, name is used instead"
runs:
using: "docker"
image: "docker://ghcr.io/grafana/issue-team-scheduler-ic-assignment:v0.14"
image: "docker://ghcr.io/grafana/issue-team-scheduler-ic-assignment:v0.15"
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
2 changes: 1 addition & 1 deletion regex-labeler/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ inputs:
description: "GitHub token to use for API calls"
runs:
using: "docker"
image: "docker://ghcr.io/grafana/issue-team-scheduler-regex-labeler:v0.14"
image: "docker://ghcr.io/grafana/issue-team-scheduler-regex-labeler:v0.15"

0 comments on commit 3bcf252

Please sign in to comment.