Skip to content

Commit

Permalink
delayTime -> delay
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Jan 8, 2019
1 parent d5de9a5 commit 841f206
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
## Inspiration / Use Cases

#### Merging PRs

Potential labels: `merge when passing`, `docs`

Plotly allows all PRs marked :dancer: and with a passing build to be merged. Instead they could use Ranger and add a :dancer: label.
Plotly allows all PRs marked :dancer: and with a passing build to be merged. Instead they could use Ranger and add a :dancer: label.

Kent C. Dodds also merges tons of PRs from his phone without testing the branch directly, relying solely on CI. Using Ranger would make this a lot simpler since he could just apply the label and then forget about the PR completely.

#### Closing issues

Potential labels: `wontfix`, `invalid`, `stale`

In Carbon, issues labeled `theme/language` are closed after some time to allow other users to not only see the comments, but potentially offer PRs to solve the issue.

#### Reopening issues

Potential labels: `snooze`, `backlog`, `future`

Some issues, for example those labeled "future" in this repository, could be closed and marked to be reopened for consideration in the future
Some issues, for example those labeled "future" in this repository, could be closed and marked to be reopened for consideration in the future

## Usage

Expand All @@ -33,19 +36,19 @@ default:
close:
# Default time to wait before closing the label. Can either be a number in milliseconds
# or a string specified by the `ms` package (https://www.npmjs.com/package/ms)
delayTime: "7 days"
delay: "7 days"

# Default comment to post when an issue is first marked with a closing label
#
# $ClOSE_TIME will automatically be replaced with `delayTime` as a formatted string (e.g. '7 days')
# $ClOSE_TIME will automatically be replaced with `delay` as a formatted string (e.g. '7 days')
# $LABEL will automatically be replaced with the label's name
comment: "⚠️ This issue has been marked to be closed in $CLOSE_TIME".

# Map granular configurations you can set for each label
labels:
duplicate:
action: close
delayTime: 15s
delay: 15s
comment: "Duplicate issue created! Closing in $CLOSE_TIME . . ."
invalid: close # use defaults for comment and delay time
'merge when passing': merge
Expand All @@ -56,7 +59,7 @@ labels:
To get started:
1. `yarn`
2. Create a `.env` file following `.env.example`
2. Create a `.env` file following `.env.example`
3. [Download a private key](https://github.com/organizations/dawnlabs/settings/apps/issue-maintainer-dev) to the root of your directory
4. Create a new webhook proxy at https://smee.io (or use the one listed in the GitHub App Settings)
5. Set `WEBHOOK_PROXY_URL` to the webhook URL in your `.env`
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const defaultConfig = {
default: {
[CLOSE]: {
comment: DEFAULT_COMMENT,
delayTime: DEFAULT_CLOSE_TIME
delay: DEFAULT_CLOSE_TIME
}
},
labels: DEFAULT_LABELS
Expand Down
2 changes: 1 addition & 1 deletion src/issue/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function timeToNumber(time) {
function getEffectiveLabel(config, labels) {
return labels.reduce(
(accum, label) => {
const time = timeToNumber(getLabelConfig(config, label.name).delayTime)
const time = timeToNumber(getLabelConfig(config, label.name).delay)

if (time < accum.time) {
return { label, time }
Expand Down
8 changes: 4 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ const config = `
labels:
duplicate:
action: close
delayTime: 5ms
delay: 5ms
comment: $LABEL issue created! Closing in $CLOSE_TIME . . .
invalid: close
wontfix:
action: close
delayTime: 10ms
delay: 10ms
comment: false
automerge:
action: merge
-1:
action: close
delayTime: -1
delay: -1
comment: Test comment
comment:
action: comment
Expand All @@ -108,7 +108,7 @@ labels:
action: comment
message: boop
delayTime: 1ms
delay: 1ms
comment: This issue has been marked to be closed in $CLOSE_TIME.
`
Expand Down

0 comments on commit 841f206

Please # to comment.