From fa62fe01f887ff4c905b130d29ccbc346054a1be Mon Sep 17 00:00:00 2001 From: grassedge Date: Wed, 25 Dec 2019 00:40:01 +0900 Subject: [PATCH] fix --- .github/workflows/main.yml | 5 ++++- dist/index.js | 9 +++++---- src/main.ts | 10 +++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e437e7..4d5a496 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,8 @@ name: generate plantuml -on: push +on: + push: + branches: + - master jobs: generate_plantuml: runs-on: ubuntu-latest diff --git a/dist/index.js b/dist/index.js index 79fc1fa..61c7e46 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4402,19 +4402,20 @@ const octokit = new github.GitHub(process.env.GITHUB_TOKEN); } const treeRes = yield octokit.git.createTree({ owner, repo, tree, - base_tree: commits[0].tree.sha, + base_tree: commits[commits.length - 1].commit.tree.sha, }); const createdCommitRes = yield octokit.git.createCommit({ owner, repo, message: `Generate svg files`, - parents: [commits[0].sha], + parents: [commits[commits.length - 1].sha], tree: treeRes.data.sha, }); const updatedRefRes = yield octokit.git.updateRef({ - owner, repo, ref, + owner, repo, + ref: ref.replace(/^refs\//, ''), sha: createdCommitRes.data.sha, }); - console.log(`${tree.map(t => t.path).join("\n")} Abobe files are generated.`); + console.log(`${tree.map(t => t.path).join("\n")}\nAbobe files are generated.`); }); })().catch(e => { core.setFailed(e); diff --git a/src/main.ts b/src/main.ts index d66ba5b..36fdf77 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,7 +34,6 @@ if (!process.env.GITHUB_TOKEN) { const octokit = new github.GitHub(process.env.GITHUB_TOKEN); (async function main() { - const payload = github.context.payload; const ref = payload.ref; if (!payload.repository) { @@ -89,22 +88,23 @@ const octokit = new github.GitHub(process.env.GITHUB_TOKEN); const treeRes = await octokit.git.createTree({ owner, repo, tree, - base_tree: commits[0].tree.sha, + base_tree: commits[commits.length - 1].commit.tree.sha, }); const createdCommitRes = await octokit.git.createCommit({ owner, repo, message: `Generate svg files`, - parents: [ commits[0].sha ], + parents: [ commits[commits.length - 1].sha ], tree: treeRes.data.sha, }); const updatedRefRes = await octokit.git.updateRef({ - owner, repo, ref, + owner, repo, + ref: ref.replace(/^refs\//, ''), sha: createdCommitRes.data.sha, }); - console.log(`${tree.map(t => t.path).join("\n")} Abobe files are generated.`); + console.log(`${tree.map(t => t.path).join("\n")}\nAbobe files are generated.`); })().catch(e => { core.setFailed(e); });