diff --git a/includes/usr/bin/annotations.py b/includes/usr/bin/annotations.py index 733983b..4ffef7b 100755 --- a/includes/usr/bin/annotations.py +++ b/includes/usr/bin/annotations.py @@ -6,7 +6,7 @@ import json # import requests import os - +# API Docs: https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request def default_matcher( entry, tool_name = '' ) -> dict: @@ -277,6 +277,15 @@ for msg_type, value in review_body.items(): ) +if len(api_body['comments']) == 0: + + api_body.update({ + 'event': 'APPROVE' + }) + del api_body['body'] + + + data = { "pull_request": pull_request, "api_body": api_body diff --git a/playbooks/problem_matcher.yaml b/playbooks/problem_matcher.yaml index 443d9d8..656ff71 100644 --- a/playbooks/problem_matcher.yaml +++ b/playbooks/problem_matcher.yaml @@ -18,14 +18,14 @@ ansible.builtin.set_fact: git_api_url: "{{ payload.repository.url }}" when: > - git_api_url == "" + git_api_url == "" - name: Set var gitea_replace_url if empty ansible.builtin.set_fact: gitea_replace_url: "{{ payload.repository.url }}" when: > - gitea_replace_url == "" + gitea_replace_url == "" - name: Set required Facts