From abd659875dacf6521949119d892644b8e3b5ed4c Mon Sep 17 00:00:00 2001 From: Kamran Ayub Date: Sun, 5 Jul 2020 19:52:50 -0500 Subject: [PATCH] Fix gh sha --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ccc4c8db..d748bf37 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,11 @@ const waitForUrl = async (url, MAX_TIMEOUT) => { const run = async () => { try { const netlifyToken = process.env.NETLIFY_TOKEN; - const commitSha = github.context.sha; + // In a PR, github.contex.sha refers to the last merge commit SHA + // not the *latest commit* of the PR which is what Netlify uses. Instead, + // have to use github.context.event.pull_request.head.sha + // See: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request + const commitSha = github.context.event.pull_request.head.sha; const MAX_TIMEOUT = Number(core.getInput("max_timeout")) || 60; const siteName = core.getInput("site_name"); if (!netlifyToken) {