diff options
| author | AlexSm <[email protected]> | 2024-01-19 17:43:03 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-19 17:43:03 +0100 |
| commit | 610b3da211be5d7cfd27077f22b876aedaa2dc29 (patch) | |
| tree | 74029d5683a7fe3e61668f4db1efa6e556a4e0d2 /.github/scripts | |
| parent | 7eb49cbff13f980e7ef44c06bb0dff2c2c9aeb40 (diff) | |
Avoid failure of pr_comment procedure when called outside PR context, e.g. in the Postcommit checks (#1172)
Diffstat (limited to '.github/scripts')
| -rwxr-xr-x | .github/scripts/tests/comment-pr.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/.github/scripts/tests/comment-pr.py b/.github/scripts/tests/comment-pr.py index 26af28e27ea..6836d41d662 100755 --- a/.github/scripts/tests/comment-pr.py +++ b/.github/scripts/tests/comment-pr.py @@ -30,9 +30,10 @@ def main(): with open(os.environ["GITHUB_EVENT_PATH"]) as fp: event = json.load(fp) - pr = gh.create_from_raw_data(PullRequest, event["pull_request"]) - - update_pr_comment_text(pr, build_preset, color, args.text.read().rstrip(), args.rewrite) + prnum = event.get("pull_request") + if not prnum is None: + pr = gh.create_from_raw_data(PullRequest, prnum) + update_pr_comment_text(pr, build_preset, color, args.text.read().rstrip(), args.rewrite) if __name__ == "__main__": |
