Skip to content

Commit

Permalink
feat(inputs): add new inputs to only process items with specific assi…
Browse files Browse the repository at this point in the history
…gnees

Add the input `issue-only-any-assignees`.
Add the input `pull-request-only-any-assignees`.
You can use them to only process issues and PRs which have one of the specified assignee(s).
Closes #559
  • Loading branch information
C0ZEN committed Apr 18, 2022
1 parent d3cf5c1 commit 2fc8bda
Show file tree
Hide file tree
Showing 25 changed files with 1,992 additions and 158 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -143,6 +143,7 @@ To help us have a clear vision over the workflow and also for you if you are jus
- Check if the issue creation date is before x date and stop the processing if this is the case (coming from the `issue-ignore-before-creation-date` input)
- Check if the input `issue-only-any-project-cards` contains some project cards. If this is the case and the issue has at least one project card matching linked to it, the processing will continue, else the processing will stop.
- Check if the input `issue-only-any-milestones` contains some milestones. If this is the case and the issue has at least one milestone matching linked to it, the processing will continue, else the processing will stop.
- Check if the input `issue-only-any-assignees` contains some assignees. If this is the case and the issue has at least one assignee matching linked to it, the processing will continue, else the processing will stop.
- Check if the issue has already a stale state (stale label)
- If the issue has a stale label, check if it was updated after the addition of the stale label
- If it was updated, remove the stale state (stale label) and stop the processing
Expand Down Expand Up @@ -181,6 +182,7 @@ To help us have a clear vision over the workflow and also for you if you are jus
- Check if the pull request is a draft and stop the processing if this is the case (coming from the `pull-request-ignore-draft` input)
- Check if the input `pull-request-only-any-project-cards` contains some project cards. If this is the case and the pull request has at least one project card matching linked to it, the processing will continue, else the processing will stop.
- Check if the input `pull-request-only-any-milestones` contains some milestones. If this is the case and the pull request has at least one milestone matching linked to it, the processing will continue, else the processing will stop.
- Check if the input `pull-request-only-any-assignees` contains some assignees. If this is the case and the pull request has at least one assignee matching linked to it, the processing will continue, else the processing will stop.
- Check if the pull request has already a stale state (stale label)
- If the pull request has a stale label, check if it was updated after the addition of the stale label
- If it was updated, remove the stale state (stale label) and stop the processing
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -100,6 +100,7 @@ All the inputs that are used both for issues and pull requests.
| [issue-only-any-milestones](https://sonia-corporation.github.io/stale/docs/issues/inputs/issue-only-any-milestones-input) | Only allow the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-any-milestones](https://sonia-corporation.github.io/stale/docs/issues/inputs/issue-ignore-any-milestones-input) | Allow to ignore the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-all-milestones](https://sonia-corporation.github.io/stale/docs/issues/inputs/issue-ignore-all-milestones-input) | Allow to ignore the processing of issues that contains any milestones. | `false` |
| [issue-only-any-assignees](https://sonia-corporation.github.io/stale/docs/issues/inputs/issue-only-any-assignees-input) | Only allow the processing of issues that contains one of those assignees (multiline). | |

## All the issues outputs

Expand Down Expand Up @@ -146,6 +147,7 @@ All the inputs that are used both for issues and pull requests.
| [pull-request-only-any-milestones](https://sonia-corporation.github.io/stale/docs/pull-requests/inputs/pull-request-only-any-milestones-input) | Only allow the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-any-milestones](https://sonia-corporation.github.io/stale/docs/pull-requests/inputs/pull-request-ignore-any-milestones-input) | Allow to ignore the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-all-milestones](https://sonia-corporation.github.io/stale/docs/pull-requests/inputs/pull-request-ignore-all-milestones-input) | Allow to ignore the processing of pull requests that contains any milestones. | `false` |
| [pull-request-only-any-assignees](https://sonia-corporation.github.io/stale/docs/pull-requests/inputs/pull-request-only-any-assignees-input) | Only allow the processing of pull requests that contains one of those assignees (multiline). | |

## All the pull requests outputs

Expand Down
8 changes: 8 additions & 0 deletions action.yml
Expand Up @@ -96,6 +96,10 @@ inputs:
description: 'Allow to ignore the processing of issues that contains any milestones.'
required: false
default: 'false'
issue-only-any-assignees:
description: 'Only allow the processing of issues that contains one of those assignees (multiline).'
required: false
default: ''
# Pull request inputs
pull-request-stale-label:
description: 'The label that will be added to the pull request when it is stale.'
Expand Down Expand Up @@ -193,6 +197,10 @@ inputs:
description: 'Allow to ignore the processing of pull requests that contains any milestones.'
required: false
default: 'false'
pull-request-only-any-assignees:
description: 'Only allow the processing of pull requests that contains one of those assignees (multiline).'
required: false
default: ''
outputs:
# Issues outputs
processed-issues-count:
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions documentation/docs/03-all-inputs.mdx
Expand Up @@ -38,6 +38,7 @@ The list of all the inputs.
| [issue-only-any-milestones](issues/inputs/issue-only-any-milestones-input) | Only allow the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-any-milestones](issues/inputs/issue-ignore-any-milestones-input) | Allow to ignore the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-all-milestones](issues/inputs/issue-ignore-all-milestones-input) | Allow to ignore the processing of issues that contains any milestones. | `false` |
| [issue-only-any-assignees](issues/inputs/issue-only-any-assignees-input) | Only allow the processing of issues that contains one of those assignees (multiline). | |
| [pull-request-stale-label](pull-requests/inputs/pull-request-stale-label-input) | The label that will be added to the pull request when it is stale. | `stale` |
| [pull-request-ignore-all-labels](pull-requests/inputs/pull-request-ignore-all-labels-input) | Allow to ignore the processing of pull requests that contains any labels. | `false` |
| [pull-request-ignore-any-labels](pull-requests/inputs/pull-request-ignore-any-labels-input) | Allow to ignore the processing of pull requests that contains one of those labels (multiline). | |
Expand All @@ -62,3 +63,4 @@ The list of all the inputs.
| [pull-request-only-any-milestones](pull-requests/inputs/pull-request-only-any-milestones-input) | Only allow the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-any-milestones](pull-requests/inputs/pull-request-ignore-any-milestones-input) | Allow to ignore the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-all-milestones](pull-requests/inputs/pull-request-ignore-all-milestones-input) | Allow to ignore the processing of pull requests that contains any milestones. | `false` |
| [pull-request-only-any-assignees](pull-requests/inputs/pull-request-only-any-assignees-input) | Only allow the processing of pull requests that contains one of those assignees (multiline). | |
1 change: 1 addition & 0 deletions documentation/docs/06-issues/01-inputs/01-all-inputs.mdx
Expand Up @@ -33,3 +33,4 @@ The list of all issues the inputs.
| [issue-only-any-milestones](issue-only-any-milestones-input) | Only allow the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-any-milestones](issue-ignore-any-milestones-input) | Allow to ignore the processing of issues that contains one of those milestones (multiline). | |
| [issue-ignore-all-milestones](issue-ignore-all-milestones-input) | Allow to ignore the processing of issues that contains any milestones. | `false` |
| [issue-only-any-assignees](issue-only-any-assignees-input) | Only allow the processing of issues that contains one of those assignees (multiline). | |
@@ -0,0 +1,35 @@
---
id: issue-only-any-assignees-input
title: Issue only any assignees input
description: |
All the information you need to know about the issue only any assignees input.
Including a detailed description and an example.
tags:
- Issues
- Inputs
- Assignees
---

### Input {#input}

Name: `issue-only-any-assignees`
Type: `string[]`
Default value: `[]`

### Description {#description}

This input will let you process only the issues that are linked to an assignee which is white-listed with this input.
This can be useful when you use the assignees for triage.

### Example {#example}

```yml {6-8}
# ...
name: Stale
id: stale
uses: sonia-corporation/stale@latest
with:
issue-only-any-assignees: |
C0ZEN
maintainers
```
Expand Up @@ -36,3 +36,4 @@ The list of all the pull requests inputs.
| [pull-request-only-any-milestones](pull-request-only-any-milestones-input) | Only allow the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-any-milestones](pull-request-ignore-any-milestones-input) | Allow to ignore the processing of pull requests that contains one of those milestones (multiline). | |
| [pull-request-ignore-all-milestones](pull-request-ignore-all-milestones-input) | Allow to ignore the processing of pull requests that contains any milestones. | `true` |
| [pull-request-only-any-assignees](pull-request-only-any-assignees-input) | Only allow the processing of pull requests that contains one of those assignees (multiline). | |
@@ -0,0 +1,35 @@
---
id: pull-request-only-any-assignees-input
title: Pull request only any assignees input
description: |
All the information you need to know about the pull request only any assignees input.
Including a detailed description and an example.
tags:
- Pull requests
- Inputs
- Assignees
---

### Input {#input}

Name: `pull-request-only-any-assignees`
Type: `string[]`
Default value: `[]`

### Description {#description}

This input will let you process only the pull requests that are linked to an assignee which is white-listed with this input.
This can be useful when you use the assignees for triage.

### Example {#example}

```yml {6-8}
# ...
name: Stale
id: stale
uses: sonia-corporation/stale@latest
with:
pull-request-only-any-assignees: |
C0ZEN
maintainers
```
1 change: 0 additions & 1 deletion documentation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/core/inputs/inputs.enum.ts
Expand Up @@ -17,6 +17,7 @@ export enum EInputs {
ISSUE_IGNORE_BEFORE_CREATION_DATE = `issue-ignore-before-creation-date`,
ISSUE_LIMIT_API_MUTATIONS_COUNT = `issue-limit-api-mutations-count`,
ISSUE_LIMIT_API_QUERIES_COUNT = `issue-limit-api-queries-count`,
ISSUE_ONLY_ANY_ASSIGNEES = `issue-only-any-assignees`,
ISSUE_ONLY_ANY_MILESTONES = `issue-only-any-milestones`,
ISSUE_ONLY_ANY_PROJECT_CARDS = `issue-only-any-project-cards`,
ISSUE_PROCESSING = `issue-processing`,
Expand All @@ -41,6 +42,7 @@ export enum EInputs {
PULL_REQUEST_LIMIT_API_MUTATIONS_COUNT = `pull-request-limit-api-mutations-count`,
PULL_REQUEST_LIMIT_API_QUERIES_COUNT = `pull-request-limit-api-queries-count`,
PULL_REQUEST_ONLY_ANY_MILESTONES = `pull-request-only-any-milestones`,
PULL_REQUEST_ONLY_ANY_ASSIGNEES = `pull-request-only-any-assignees`,
PULL_REQUEST_ONLY_ANY_PROJECT_CARDS = `pull-request-only-any-project-cards`,
PULL_REQUEST_PROCESSING = `pull-request-processing`,
PULL_REQUEST_STALE_COMMENT = `pull-request-stale-comment`,
Expand Down
1 change: 1 addition & 0 deletions src/core/inputs/interfaces/issues-inputs.interface.ts
Expand Up @@ -19,6 +19,7 @@ export interface IIssuesInputs extends IInputs {
readonly issueIgnoreBeforeCreationDate: IIso8601Date | '';
readonly issueLimitApiMutationsCount: number;
readonly issueLimitApiQueriesCount: number;
readonly issueOnlyAnyAssignees: string[];
readonly issueOnlyAnyMilestones: string[];
readonly issueOnlyAnyProjectCards: string[];
readonly issueProcessing: boolean;
Expand Down
Expand Up @@ -21,6 +21,7 @@ export interface IPullRequestsInputs extends IInputs {
readonly pullRequestIgnoreDraft: boolean;
readonly pullRequestLimitApiMutationsCount: number;
readonly pullRequestLimitApiQueriesCount: number;
readonly pullRequestOnlyAnyAssignees: string[];
readonly pullRequestOnlyAnyMilestones: string[];
readonly pullRequestOnlyAnyProjectCards: string[];
readonly pullRequestProcessing: boolean;
Expand Down

0 comments on commit 2fc8bda

Please sign in to comment.