1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

Enhance app rejection (#2528)

This commit is contained in:
tituspijean 2024-08-18 13:42:39 +02:00 committed by GitHub
parent 35eb4d3ee3
commit 93c6170b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View file

@ -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

View file

@ -7,3 +7,4 @@ websockets==10.0
babel
langcodes
language_data
requests

View file

@ -11,6 +11,7 @@ import aiohttp
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")