diff --git a/dist/index.js b/dist/index.js index 4dde0c0..e1bd720 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6372,6 +6372,7 @@ process.env.GITHUB_TOKEN = process.argv[2]; const mainBranchName = process.argv[3]; const errorOnNoSuccessfulWorkflow = process.argv[4]; const workflowId = process.argv[5]; +const lastSuccessfulEvent = process.argv[6]; let BASE_SHA; (async () => { @@ -6381,7 +6382,7 @@ let BASE_SHA; BASE_SHA = execSync(`git merge-base origin/${mainBranchName} HEAD`, { encoding: 'utf-8' }); } else { try { - BASE_SHA = await findSuccessfulCommit(workflowId, runId, owner, repo, mainBranchName); + BASE_SHA = await findSuccessfulCommit(workflowId, runId, owner, repo, mainBranchName, lastSuccessfulEvent); } catch (e) { core.setFailed(e.message); return; @@ -6429,7 +6430,7 @@ function reportFailure(branchName) { * @param {string} branch * @returns */ -async function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch) { +async function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch, lastSuccessfulEvent) { const octokit = new Octokit(); if (!workflow_id) { workflow_id = await octokit.request(`GET /repos/${owner}/${repo}/actions/runs/${run_id}`, { @@ -6445,7 +6446,7 @@ async function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch) { repo, branch, workflow_id, - event: 'push', + event: lastSuccessfulEvent, status: 'success' }).then(({ data: { workflow_runs } }) => workflow_runs.map(run => run.head_sha)); diff --git a/package.json b/package.json index f0b0bd4..b4e8f48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "description": "This package.json is here purely to control the version of the Action, in combination with https://github.com/JamesHenry/publish-shell-action", "scripts": { @@ -16,4 +16,4 @@ "@octokit/action": "^3.10.10", "@vercel/ncc": "^0.29.0" } -} +} \ No newline at end of file