From dc57a65a1c92711b11c4a2ba0678ae382e0e529a Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 12 Jul 2025 19:22:45 +0930 Subject: [PATCH] feat(problem_matcher): when not enabled, dont process further ref: #6 --- includes/usr/bin/annotations.py | 6 +++++- playbooks/problem_matcher.yaml | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/usr/bin/annotations.py b/includes/usr/bin/annotations.py index 4ffef7b..ce05480 100755 --- a/includes/usr/bin/annotations.py +++ b/includes/usr/bin/annotations.py @@ -205,7 +205,11 @@ for line in sys.stdin: if not NFC_PROBLEM_MATCHER: - sys.exit(2) + print(json.dumps({ + 'pull_request': '' + }, indent=4)) + + sys.exit(0) if not results: diff --git a/playbooks/problem_matcher.yaml b/playbooks/problem_matcher.yaml index 656ff71..94a3fcb 100644 --- a/playbooks/problem_matcher.yaml +++ b/playbooks/problem_matcher.yaml @@ -94,11 +94,15 @@ validate_certs: false no_log: "{{ disable_logging }}" register: http_get_pull_request + when: > + annotations.pull_request | string - name: Trace - Display Pull Request State ansible.builtin.debug: msg: "{{ http_get_pull_request.json.state | default('No PR found') }}" + when: > + not http_get_pull_request.skipped | bool | default(false) - name: Post review @@ -116,4 +120,6 @@ when: > http_get_pull_request.json.state | default('-') != 'closed' and - http_get_pull_request.status == 200 + http_get_pull_request.status | default(0) == 200 + and + not http_get_pull_request.skipped | bool | default(false)