WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Feb 12, 2021. It is now read-only.

Commit dc16dfe

Browse files
committed
Support last
1 parent c46f232 commit dc16dfe

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ It is better to run PR bully from a CI daily. Keep in mind CI bully does not kee
1010
---
1111
## Define the token in yaml or environment variable "GITHUB_TOKEN"
1212
#token: "XxxXXXXxxxx"
13+
1314
actions:
15+
# if you specify last anything greater than last will be enforced
1416
- day: 14
17+
last: true
1518
action: close
1619
message: |
1720
Hi _USER_ this PR exceeded _SINCE_ days in open state.

config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
type action struct {
1515
Day int `yaml:"day"`
1616
Action string `yaml:"action"`
17+
Last bool `yaml:"last"`
1718
Message string `yaml:"message"`
1819
}
1920

config_example.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#token: "XxxXXXXxxxx"
44
actions:
55
- day: 14
6+
last: true
67
action: close
78
message: |
89
Hi _USER_ this PR exceeded _SINCE_ days in open state.

github.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ func actions(currentPr prType) {
2727
var actionTaken action
2828

2929
for _, actionItem := range runConfig.Actions {
30-
if currentPr.OpenSince == actionItem.Day {
30+
switch {
31+
case currentPr.OpenSince == actionItem.Day:
3132
actionTaken = actionItem
3233
takeAction = true
3334
break
35+
case currentPr.OpenSince > actionItem.Day && actionItem.Last:
36+
// Last action
37+
actionTaken = actionItem
38+
takeAction = true
3439
}
3540
}
3641
if !takeAction {

0 commit comments

Comments
 (0)