Skip to content

Commit

Permalink
Support Dry Run & No Github Issues Interaction if repo doesn't use is…
Browse files Browse the repository at this point in the history
…sues (#1228)

* Support Dry Run & No Github Issues Interaction if repo doesn't use issues

* remove incorrect import

* spelling mistake

---------

Co-authored-by: Chris Kerins <clkerins@gmail.com>
  • Loading branch information
brianhuang822 and crs-k authored Aug 2, 2024
1 parent fdfa282 commit 5c1f814
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 102 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
stale-branch-label: 'stale branch 🗑️'
compare-branches: 'info'
branches-filter-regex: '^((?!dependabot))'
pr-check: true
pr-check: true
dry-run: false
ignore-issue-interaction: false


Build:
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Inputs are defined in [`action.yml`](action.yml). None are required.:
| `compare-branches` | This compares each branch to the repo's default branch. <ul><li>When set to `info`, additional output describes if the current branch is ahead, behind, diverged, or identical to the default branch.<br>![image](https://user-images.githubusercontent.com/26232872/157590411-7c97806c-a509-4002-b7a5-a1e4a5da08eb.png)</li> <li>When set to `save`, this prevents branches from being deleted if they are ahead of or diverged from the default branch.</li> <li>When set to `off`, no additional calls are made.</li></ul> | off |
| `branches-filter-regex` | An optional Regex that will be used to filter branches from this action. | '' |
| `rate-limit` | If this is enabled, the action will stop if it exceeds 95% of the GitHub API rate limit. | true |
| `pr-check` | If this is enabled, the action will first check for incoming/outgoing PRs associated with the branch. If a branch has an active pr, it will not be ignored. | false |
| `pr-check` | If this is enabled, the action will first check for incoming/outgoing PRs associated with the branch. If a branch has an active pr, it will be ignored. | false |
| `dry-run` | If this is enabled, the action will not delete or tag any branches. | false |
| `ignore-issue-interaction` | If this is enabled, the action will not interact with Github issues. | false |

### Outputs
Outputs are defined in [`action.yml`](action.yml):
Expand Down Expand Up @@ -111,6 +113,8 @@ jobs:
branches-filter-regex: '^((?!dependabot))'
rate-limit: false
pr-check: false
dry-run: false
ignore-issue-interaction: false


```
Expand Down
4 changes: 3 additions & 1 deletion __mocks__/@actions/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const validInputs: Inputs = {
staleBranchLabel: 'stale branch 🗑️',
compareBranches: 'save',
rateLimit: true,
prCheck: false
prCheck: false,
dryRun: false,
ignoreIssueInteraction: false,
}

type ListIssuesResponseDataType = GetResponseTypeFromEndpointMethod<typeof githubActual.github.rest.issues.listForRepo>
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functions/get-context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Get Context Function', () => {
await validateInputs()

expect(core.getInput).toHaveBeenCalledTimes(6)
expect(core.getBooleanInput).toHaveBeenCalledTimes(4)
expect(core.getBooleanInput).toHaveBeenCalledTimes(6)
})

test('Expect Failure: - TypeError', async () => {
Expand Down
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ inputs:
rate-limit:
description: 'If this is enabled, the action will stop if it exceeds 95% of the GitHub API rate limit.'
required: false
default: true
default: 'true'
pr-check:
description: 'If this is enabled, the action will first check for active pull requests against the branch. If a branch has an active pr, it will not be ignored.'
required: false
default: false
default: 'false'
dry-run:
description: 'If this is enabled, the action will not delete or tag any branches.'
required: false
default: 'false'
ignore-issue-interaction:
description: 'If this is enabled, the action will not interact with Github issues.'
required: false
default: 'false'
outputs:
deleted-branches:
description: 'List of all deleted branches.'
Expand Down
Loading

0 comments on commit 5c1f814

Please sign in to comment.