Skip to content

Commit

Permalink
fix(CI): ignore check yml file warning
Browse files Browse the repository at this point in the history
This correct apply commit f989c57.

Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
  • Loading branch information
opsiff committed Jun 15, 2024
1 parent 66015fc commit 576d2c3
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/check-patches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
repo = "${{ github.event.repository.name }}"
pull_number = "${{ github.event.number }}"
commit_id = "${{ github.event.pull_request.head.sha }}"
access_token = os.environ.get("GITHUB_TOKEN")
# 获取检查脚本
check_url = 'https://raw.githubusercontent.com/deepin-community/kernel/linux-6.6.y/scripts/checkpatch.pl'
Expand All @@ -50,7 +49,10 @@ jobs:
# 获取文件列表
url = f'https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/files'
print(url)
headers = {'Authorization': f'Bearer {access_token}'}
headers = {
"Accept": "application/vnd.github+json",
"Authorization":"Bearer " + os.environ.get("GITHUB_TOKEN")
}
response = requests.get(url, headers=headers)
files = response.json()
Expand Down Expand Up @@ -97,14 +99,15 @@ jobs:
line_number = match.group().split(' ')[-1]
line_number = line_number.replace(':', '')
body = r.split('\n')[0]
comment_json = {
"body": body,
"commit_id": commit_id,
"path": path,
"line": int(line_number),
"side": "RIGHT"
}
comment_url = f"https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/comments"
response = requests.post(comment_url, json=comment_json, headers=headers)
print(response.json())
if "It's generally not useful to have the filename in the file" not in body:
comment_json = {
"body": body,
"commit_id": commit_id,
"path": path,
"line": int(line_number),
"side": "RIGHT"
}
comment_url = f"https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/comments"
response = requests.post(comment_url, json=comment_json, headers=headers)
print(response.json())

0 comments on commit 576d2c3

Please sign in to comment.