Skip to content

Commit 009b5f2

Browse files
Only post patch comment when Pull Request exists
1 parent 8e52fe2 commit 009b5f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/actions/comment_patch_url.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def patch_artifact_download_url
4747
end
4848

4949
def pull_request_number
50-
WORKFLOW_RUN['pull_requests'][0]['number']
50+
WORKFLOW_RUN.dig('pull_requests', 0, 'number')
5151
end
5252

5353
def post_pr_comment(pr_number, comment)
@@ -70,7 +70,7 @@ def main
7070
existing_comment_id = find_previous_comment_id(pull_request_number)
7171
delete_comment(existing_comment_id) if existing_comment_id
7272

73-
post_pr_comment pull_request_number, "Patch can be downloaded [here](#{patch_artifact_download_url})"
73+
post_pr_comment pull_request_number, "Patch can be downloaded [here](#{patch_artifact_download_url})" if pull_request_number
7474
end
7575

7676
main if __FILE__ == $0

0 commit comments

Comments
 (0)