Skip to content

Commit

Permalink
Enhance app rejection (#2528)
Browse files Browse the repository at this point in the history
  • Loading branch information
tituspijean authored Aug 18, 2024
1 parent 35eb4d3 commit 93c6170
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion taplo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/webhooks/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ websockets==10.0
babel
langcodes
language_data
requests
14 changes: 14 additions & 0 deletions tools/webhooks/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
from pathlib import Path
import re
import requests

from typing import Optional
from git import Actor, Repo, GitCommandError
Expand Down Expand Up @@ -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"):

Expand Down Expand Up @@ -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")


Expand Down

0 comments on commit 93c6170

Please sign in to comment.