Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow input of the labels #45

Merged
merged 3 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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"
Loading