deploy_to_netlify.py: Fix crash on the first commit of a PR (#160)

This commit is contained in:
Val Lorentz 2022-04-14 20:21:49 +02:00 committed by GitHub
parent 2cd5fc1dca
commit 9bc331483a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ context_suffix = ""
command = ["netlify", "deploy", "--dir=dashboard/"]
if is_pull_request:
pr_number = github_event["number"]
sha = github_event["after"]
sha = github_event.get("after") or github_event["pull_request"]["head"]["sha"]
# Aliases can't exceed 37 chars
command.extend(["--alias", f"pr-{pr_number}-{sha[0:10]}"])
context_suffix = " (pull_request)"