Skip to content

Commit

Permalink
chore: rebuild the last version (#9)
Browse files Browse the repository at this point in the history
* update version

* chore: rebuild the last version
  • Loading branch information
meeroslav authored Dec 17, 2021
1 parent 8ad48a3 commit 4625d88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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"
}
}
}

0 comments on commit 4625d88

Please sign in to comment.