1 Star 0 Fork 1

oepkgs/oepkgsbuild_check

forked from ydna0/oepkgsbuild_check 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gitee_message.py 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
ydna0 提交于 2023-11-27 13:21 . add notes
from tools import get_requests
class GiteeMessage(object):
"""
the result in table to comment
"""
def __init__(self,pr_num,repo_name,gitee_token):
"""
:param pr_num: the pr number
:param repo_name: the name of the repo
:param gitee_token: the toen of the gitee user
"""
self._pr_num=pr_num
self._repo_name=repo_name
self._gitee_token=gitee_token
def comment_pr(self,comment):
"""
comment pull request
:param comment: the content of the comment
:return:
whether successfully comment the pr
"""
#logger.debug("comment pull request %s", pr_num)
owner="src-oepkgs"
comment_pr_url = "https://gitee.com/api/v5/repos/{}/{}/pulls/{}/comments".format(owner, self._repo_name, self._pr_num)
data = {"access_token": self._gitee_token, "body": comment}
rs = get_requests("post", comment_pr_url, body=data, timeout=30)
if rs != 0:
#logger.warning("pr comment failed")
return False
return True
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/oepkgs/oepkgsbuild_check.git
git@gitee.com:oepkgs/oepkgsbuild_check.git
oepkgs
oepkgsbuild_check
oepkgsbuild_check
master

搜索帮助