diff --git a/dist/index.js b/dist/index.js index 9948f30..cc2f81d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -191,7 +191,7 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b const fullRepositoryName = payload.repository.full_name; // like "Codertocat/Hello-World" const isPullRequest = payload.pull_request !== undefined; - const commitId = isPullRequest ? payload.pull_request.head.sha : payload.head_commit.id; // like "ec26c3e57ca3a959ca5aad62de7213c562f8c821" + const commitId = isPullRequest ? payload.pull_request.head.sha : (payload.head_commit ? payload.head_commit.id : github.context.sha); // like "ec26c3e57ca3a959ca5aad62de7213c562f8c821" const branchName = isPullRequest ? payload.pull_request.head.ref : payload.ref.replace(/^refs\/heads\//, ''); // like "my/branch_name" console.log(`🎋 On branch '${branchName}', head commit ${commitId}`); diff --git a/index.js b/index.js index 8a7489e..a1c6d67 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ const fullRepositoryName = payload.repository.full_name; // like "Codertocat/Hello-World" const isPullRequest = payload.pull_request !== undefined; - const commitId = isPullRequest ? payload.pull_request.head.sha : payload.head_commit.id; // like "ec26c3e57ca3a959ca5aad62de7213c562f8c821" + const commitId = isPullRequest ? payload.pull_request.head.sha : (payload.head_commit ? payload.head_commit.id : github.context.sha); // like "ec26c3e57ca3a959ca5aad62de7213c562f8c821" const branchName = isPullRequest ? payload.pull_request.head.ref : payload.ref.replace(/^refs\/heads\//, ''); // like "my/branch_name" console.log(`🎋 On branch '${branchName}', head commit ${commitId}`);