diff --git a/README.md b/README.md index 51a1b8d..94878fd 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,11 @@ jobs: # Default: false error-on-no-successful-workflow: '' + # The type of event to check for the last successful commit corresponding to that workflow-id, e.g. push, pull-request, release etc. + # + # Default: push + last-successful-event: '' + # The path where your repository is. This is only required for cases where the repository code is checked out or moved to a specific path. # # Default: . diff --git a/action.yml b/action.yml index 2b28796..f30a595 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: description: "By default, if no successful workflow is found on the main branch to determine the SHA, we will log a warning and use HEAD~1. Enable this option to error and exit instead." default: "false" last-successful-event: - description: "The type of event to check for the last successful commit corresponding to that workflow-id, E.g. push, pull-request, release etc" + description: "The type of event to check for the last successful commit corresponding to that workflow-id, e.g. push, pull-request, release etc" default: "push" working-directory: description: "The directory where your repository is located" diff --git a/dist/index.js b/dist/index.js index 8bcb46a..4dd1507 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62890,7 +62890,8 @@ async function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch, la const shas = await octokit.request(`GET /repos/${owner}/${repo}/actions/workflows/${workflow_id}/runs`, { owner, repo, - branch, + // on non-push workflow runs we do not have branch property + branch: lastSuccessfulEvent !== 'push' ? undefined : branch, workflow_id, event: lastSuccessfulEvent, status: 'success' diff --git a/find-successful-workflow.js b/find-successful-workflow.js index d4b17c3..ba5b85f 100644 --- a/find-successful-workflow.js +++ b/find-successful-workflow.js @@ -97,8 +97,8 @@ async function findSuccessfulCommit(workflow_id, run_id, owner, repo, branch, la const shas = await octokit.request(`GET /repos/${owner}/${repo}/actions/workflows/${workflow_id}/runs`, { owner, repo, - // on release workflow runs do not have branch property - branch: lastSuccessfulEvent === 'release' ? undefined : branch, + // on non-push workflow runs we do not have branch property + branch: lastSuccessfulEvent !== 'push' ? undefined : branch, workflow_id, event: lastSuccessfulEvent, status: 'success' diff --git a/package-lock.json b/package-lock.json index b743bb1..7698a52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "nx-set-shas", - "version": "2.2.2", + "version": "2.2.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.2.2", + "version": "2.2.3", "license": "MIT", "dependencies": { "@actions/core": "^1.4.0", diff --git a/package.json b/package.json index 23e1342..ff0a503 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "2.2.2", + "version": "2.2.3", "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": {