Skip to content

Commit 9727594

Browse files
committed
feat(annotations): when no problem found, remove comment and set to approve PR
ref: #6 #5
1 parent 6d501e2 commit 9727594

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

includes/usr/bin/annotations.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# import requests
77
import os
88

9-
9+
# API Docs: https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
1010

1111
def default_matcher( entry, tool_name = '' ) -> dict:
1212

@@ -277,6 +277,15 @@ def pylint_matcher( entry ) -> dict:
277277
)
278278

279279

280+
if len(api_body['comments']) == 0:
281+
282+
api_body.update({
283+
'event': 'APPROVE'
284+
})
285+
del api_body['body']
286+
287+
288+
280289
data = {
281290
"pull_request": pull_request,
282291
"api_body": api_body

playbooks/problem_matcher.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
ansible.builtin.set_fact:
1919
git_api_url: "{{ payload.repository.url }}"
2020
when: >
21-
git_api_url == ""
21+
git_api_url == ""
2222
2323
2424
- name: Set var gitea_replace_url if empty
2525
ansible.builtin.set_fact:
2626
gitea_replace_url: "{{ payload.repository.url }}"
2727
when: >
28-
gitea_replace_url == ""
28+
gitea_replace_url == ""
2929
3030
3131
- name: Set required Facts

0 commit comments

Comments
 (0)