Skip to content

Commit

Permalink
update Allstar to close issues when action: "fix"
Browse files Browse the repository at this point in the history
  • Loading branch information
markdboyd authored and jeffmendoza committed Jun 20, 2022
1 parent 11e120c commit 43706b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/enforce/enforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func RunPolicies(ctx context.Context, c *github.Client, owner, repo string, enab
Msg("Unknown action configured.")
}
}
if r.Pass && a == "issue" {
if r.Pass && (a == "issue" || a == "fix") {
err := issueClose(ctx, c, owner, repo, p.Name())
if err != nil {
return nil, err
Expand Down
13 changes: 13 additions & 0 deletions pkg/enforce/enforce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ func TestRunPolicies(t *testing.T) {
"Test policy": false,
},
},
{
Name: "CloseIssueOnFix",
Res: policyRepoResults{
"fake-repo": policydef.Result{Enabled: true, Pass: true},
},
Action: "fix",
ShouldFix: false,
ShouldEnsure: false,
ShouldClose: true,
ExpEnforceResults: EnforceResults{
"Test policy": true,
},
},
{
Name: "PolicyDisabled",
Res: policyRepoResults{
Expand Down

0 comments on commit 43706b6

Please sign in to comment.