diff --git a/taplo.toml b/taplo.toml index dc581f498e..fae6d661ba 100644 --- a/taplo.toml +++ b/taplo.toml @@ -1,4 +1,4 @@ -include = [ "antifeatures.toml", "apps.toml", "categories.toml", "graveyard.toml", "taplo.toml" ] +include = [ "antifeatures.toml", "apps.toml", "categories.toml", "graveyard.toml", "taplo.toml", "rejectedlist.toml" ] [formatting] align_comments = false diff --git a/tools/webhooks/requirements.txt b/tools/webhooks/requirements.txt index 9640b65563..0c08cd6784 100644 --- a/tools/webhooks/requirements.txt +++ b/tools/webhooks/requirements.txt @@ -7,3 +7,4 @@ websockets==10.0 babel langcodes language_data +requests diff --git a/tools/webhooks/webhook.py b/tools/webhooks/webhook.py index 09db4062ed..74ddbaa137 100755 --- a/tools/webhooks/webhook.py +++ b/tools/webhooks/webhook.py @@ -11,6 +11,7 @@ import logging from pathlib import Path import re +import requests from typing import Optional from git import Actor, Repo, GitCommandError @@ -210,6 +211,7 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon data = request.json repository = data["repository"]["full_name"] branch = pr_infos["head"]["ref"] + pr_number = pr_infos["number"] if repository == "YunoHost/apps" and branch.startswith("add-to-wishlist"): @@ -252,6 +254,18 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon logging.debug(f"Pushing {repository}") repo.remote().push(quiet=False, all=True, force=True) + + new_pr_title={"title": f"Add {suggestedapp_name} to rejection list"} + with requests.Session() as s: + s.headers.update({"Authorization": f"token {github_token()}"}) + r = s.post( + f"https://api.github.com/repos/{repository}/pulls/{pr_number}", json=new_pr_title + ) + if r.status_code != 200: + logging.info( + f"PR #{pr_number} renaming failed with code {r.status_code}" + ) + return response.text("ok")