Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rebuild the last version #9

Merged
merged 2 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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;
Expand Down Expand Up @@ -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}`, {
Expand All @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -16,4 +16,4 @@
"@octokit/action": "^3.10.10",
"@vercel/ncc": "^0.29.0"
}
}
}