Skip to content

Commit

Permalink
Only post patch comment when Pull Request exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kfischer-okarin committed Feb 5, 2021
1 parent 8e52fe2 commit 009b5f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/actions/comment_patch_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def patch_artifact_download_url
end

def pull_request_number
WORKFLOW_RUN['pull_requests'][0]['number']
WORKFLOW_RUN.dig('pull_requests', 0, 'number')
end

def post_pr_comment(pr_number, comment)
Expand All @@ -70,7 +70,7 @@ def main
existing_comment_id = find_previous_comment_id(pull_request_number)
delete_comment(existing_comment_id) if existing_comment_id

post_pr_comment pull_request_number, "Patch can be downloaded [here](#{patch_artifact_download_url})"
post_pr_comment pull_request_number, "Patch can be downloaded [here](#{patch_artifact_download_url})" if pull_request_number
end

main if __FILE__ == $0

0 comments on commit 009b5f2

Please sign in to comment.