mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
parent
315813a568
commit
7712fef2fd
@ -37,7 +37,7 @@ Create a `workflow.yml` file in your `.github/workflows` directory like:
|
|||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@master"
|
- uses: "actions/checkout@master"
|
||||||
- name: "TODO to Issue"
|
- name: "TODO to Issue"
|
||||||
uses: "alstr/todo-to-issue-action@v4.3.1"
|
uses: "alstr/todo-to-issue-action@v4.4"
|
||||||
id: "todo"
|
id: "todo"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ The workflow file takes the following optional inputs:
|
|||||||
| `CLOSE_ISSUES` | No | Optional boolean input that specifies whether to attempt to close an issue when a TODO is removed. Default: `true`. |
|
| `CLOSE_ISSUES` | No | Optional boolean input that specifies whether to attempt to close an issue when a TODO is removed. Default: `true`. |
|
||||||
| `AUTO_P` | No | Optional boolean input that specifies whether to format each line in multiline TODOs as a new paragraph. Default: `true`. |
|
| `AUTO_P` | No | Optional boolean input that specifies whether to format each line in multiline TODOs as a new paragraph. Default: `true`. |
|
||||||
| `IGNORE` | No | Optional string input that provides comma-delimited regular expressions that match files in the repo that we should not scan for TODOs. By default, we will scan all files. |
|
| `IGNORE` | No | Optional string input that provides comma-delimited regular expressions that match files in the repo that we should not scan for TODOs. By default, we will scan all files. |
|
||||||
|
| `AUTO_ASSIGN` | No | Optional boolean input that specifies whether to assign the newly created issue to the user who triggered the action. If users are manually assigned to an issue, this setting is ignored. Default: `false`. |
|
||||||
|
|
||||||
These can be specified in `with` in the workflow file.
|
These can be specified in `with` in the workflow file.
|
||||||
|
|
||||||
|
|||||||
@ -58,3 +58,11 @@ inputs:
|
|||||||
IGNORE:
|
IGNORE:
|
||||||
description: "A collection of comma-delimited regular expression that matches files that should be ignored when searching for TODOs"
|
description: "A collection of comma-delimited regular expression that matches files that should be ignored when searching for TODOs"
|
||||||
required: false
|
required: false
|
||||||
|
AUTO_ASSIGN:
|
||||||
|
description: "Automatically assign new issues to the user who triggered the action"
|
||||||
|
required: true
|
||||||
|
default: false
|
||||||
|
ACTOR:
|
||||||
|
description: "The username of the person who triggered the action"
|
||||||
|
required: true
|
||||||
|
default: "${{ github.actor }}"
|
||||||
4
main.py
4
main.py
@ -62,6 +62,8 @@ class GitHubClient(object):
|
|||||||
self.line_break = '\n\n' if auto_p else '\n'
|
self.line_break = '\n\n' if auto_p else '\n'
|
||||||
# Retrieve the existing repo issues now so we can easily check them later.
|
# Retrieve the existing repo issues now so we can easily check them later.
|
||||||
self._get_existing_issues()
|
self._get_existing_issues()
|
||||||
|
self.auto_assign = os.getenv('INPUT_AUTO_ASSIGN', 'false') == 'true'
|
||||||
|
self.actor = os.getenv('INPUT_ACTOR')
|
||||||
|
|
||||||
def get_timestamp(self, commit):
|
def get_timestamp(self, commit):
|
||||||
return commit.get('timestamp')
|
return commit.get('timestamp')
|
||||||
@ -146,6 +148,8 @@ class GitHubClient(object):
|
|||||||
|
|
||||||
# We need to check if any assignees/milestone specified exist, otherwise issue creation will fail.
|
# We need to check if any assignees/milestone specified exist, otherwise issue creation will fail.
|
||||||
valid_assignees = []
|
valid_assignees = []
|
||||||
|
if len(issue.assignees) == 0 and self.auto_assign:
|
||||||
|
valid_assignees.append(self.actor)
|
||||||
for assignee in issue.assignees:
|
for assignee in issue.assignees:
|
||||||
assignee_url = f'{self.repos_url}{self.repo}/assignees/{assignee}'
|
assignee_url = f'{self.repos_url}{self.repo}/assignees/{assignee}'
|
||||||
assignee_request = requests.get(url=assignee_url, headers=self.issue_headers)
|
assignee_request = requests.get(url=assignee_url, headers=self.issue_headers)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user