feat: create comment
This commit is contained in:
parent
dac569259b
commit
a497f03089
|
@ -62,6 +62,10 @@ create channels for student groups according to group information on gitea. Opti
|
||||||
|
|
||||||
Example: `python3 -m joint_teapot create-channels-on-mm --prefix p1 --suffix -private --invite-teaching-team` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. And teaching team (adjust in `.env`) will be invited to the channels.
|
Example: `python3 -m joint_teapot create-channels-on-mm --prefix p1 --suffix -private --invite-teaching-team` will fetch all repos whose names start with `"p1"` and create channels on mm for these repos like "p1team1-private". Members of a repo will be added to the corresponding channel. And teaching team (adjust in `.env`) will be invited to the channels.
|
||||||
|
|
||||||
|
### `create-comment`
|
||||||
|
|
||||||
|
create a comment for an issue on gitea.
|
||||||
|
|
||||||
### `create-issues`
|
### `create-issues`
|
||||||
|
|
||||||
create issues on gitea. Specify a list of repos (use `--regex` to match against list of patterns), a title, and a body (use `--file` to read from file), in this order.
|
create issues on gitea. Specify a list of repos (use `--regex` to match against list of patterns), a title, and a body (use `--file` to read from file), in this order.
|
||||||
|
|
|
@ -75,6 +75,15 @@ def create_issue_for_repos(
|
||||||
tea.pot.create_issue_for_repos(repo_names, title, body, from_file, use_regex)
|
tea.pot.create_issue_for_repos(repo_names, title, body, from_file, use_regex)
|
||||||
|
|
||||||
|
|
||||||
|
@app.command("create-comment", help="create a comment for an issue on gitea")
|
||||||
|
def create_comment(
|
||||||
|
repo_name: str,
|
||||||
|
index: int,
|
||||||
|
body: str = Argument(..., help="comment body"),
|
||||||
|
) -> None:
|
||||||
|
tea.pot.create_comment(repo_name, index, body)
|
||||||
|
|
||||||
|
|
||||||
@app.command("create-milestones", help="create milestones on gitea")
|
@app.command("create-milestones", help="create milestones on gitea")
|
||||||
def create_milestone_for_repos(
|
def create_milestone_for_repos(
|
||||||
repo_names: List[str], title: str, description: str, due_on: datetime
|
repo_names: List[str], title: str, description: str, due_on: datetime
|
||||||
|
|
|
@ -152,6 +152,14 @@ class Teapot:
|
||||||
for repo_name in affected_repos:
|
for repo_name in affected_repos:
|
||||||
self.gitea.create_issue(repo_name, title, content)
|
self.gitea.create_issue(repo_name, title, content)
|
||||||
|
|
||||||
|
def create_comment(
|
||||||
|
self,
|
||||||
|
repo_name: str,
|
||||||
|
index: int,
|
||||||
|
body: str,
|
||||||
|
) -> None:
|
||||||
|
self.gitea.create_comment(repo_name, index, body)
|
||||||
|
|
||||||
def create_milestone_for_repos(
|
def create_milestone_for_repos(
|
||||||
self, repo_names: List[str], title: str, description: str, due_on: datetime
|
self, repo_names: List[str], title: str, description: str, due_on: datetime
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
@ -346,6 +346,20 @@ class Gitea:
|
||||||
)
|
)
|
||||||
logger.info(f'Created issue "{title}" in {repo_name}')
|
logger.info(f'Created issue "{title}" in {repo_name}')
|
||||||
|
|
||||||
|
def create_comment(
|
||||||
|
self,
|
||||||
|
repo_name: str,
|
||||||
|
index: int,
|
||||||
|
body: str,
|
||||||
|
) -> None:
|
||||||
|
self.issue_api.issue_create_comment(
|
||||||
|
self.org_name,
|
||||||
|
repo_name,
|
||||||
|
index,
|
||||||
|
body={"body": body},
|
||||||
|
)
|
||||||
|
logger.info(f"Created comment in {repo_name}/issues/{index}")
|
||||||
|
|
||||||
def create_milestone(
|
def create_milestone(
|
||||||
self,
|
self,
|
||||||
repo_name: str,
|
repo_name: str,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user