Skip to content

Commit

Permalink
fix: fix stalledDays conditions
Browse files Browse the repository at this point in the history
includes boundary to support options.stalledDays: 0
  • Loading branch information
azu committed Mar 11, 2020
1 parent d797a11 commit a0f0eec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/delete-github-branches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type deleteGitHubBranchesOptions = {
* You can set deletable stalled days after the branch is last pushed
* Delete branches that are stalled 30 days by default
* if today >= lastPushedDate + 30, its deletable
* if you set options.stalledDay is 0, delete the branch match patterns immediately
* Default: 30
*/
stalledDays?: number;
Expand Down Expand Up @@ -222,7 +223,7 @@ export const deleteGitHubBranches = async (options: deleteGitHubBranchesOptions)
// The branch is stalled day is later than options.stalledDays
// Today - lastPushedDate
const diffDays = dayjs().diff(branch.lastPushedDate, "day");
if (diffDays < stalledDays) {
if (diffDays <= stalledDays) {
results.push({
branchName: branch.branchName,
deleted: false,
Expand Down

0 comments on commit a0f0eec

Please sign in to comment.