Skip to content

Commit

Permalink
chore: change newBranch API -> currentRef API
Browse files Browse the repository at this point in the history
  • Loading branch information
junghyeonsu committed May 23, 2023
1 parent 53e37c7 commit 3fa3c01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/figma-svg-extract-action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11381,16 +11381,16 @@ repo, targetBranch, }) => __awaiter(void 0, void 0, void 0, function* () {
tree: tree.data.sha,
parents: [baseBranch.commit.sha],
});
const newBranch = yield octokit.request("POST /repos/{owner}/{repo}/git/refs", {
const currentRef = yield octokit.request("GET /repos/{owner}/{repo}/git/ref/{ref}", {
owner,
repo,
ref: `refs/heads/${targetBranch}`,
ref: `heads/${targetBranch}`,
sha: commit.data.sha,
});
yield octokit.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
owner,
repo,
ref: newBranch.data.ref,
ref: currentRef.data.ref,
sha: commit.data.sha,
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/figma-svg-extract-action/dist/octokit.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ repo, targetBranch, }) => __awaiter(void 0, void 0, void 0, function* () {
tree: tree.data.sha,
parents: [baseBranch.commit.sha],
});
const newBranch = yield octokit.request("POST /repos/{owner}/{repo}/git/refs", {
const currentRef = yield octokit.request("GET /repos/{owner}/{repo}/git/ref/{ref}", {
owner,
repo,
ref: `refs/heads/${targetBranch}`,
ref: `heads/${targetBranch}`,
sha: commit.data.sha,
});
yield octokit.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
owner,
repo,
ref: newBranch.data.ref,
ref: currentRef.data.ref,
sha: commit.data.sha,
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/figma-svg-extract-action/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figma-svg-extract-action",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/index.js",
"scripts": {
"build": "tsc && ncc build"
Expand Down
8 changes: 4 additions & 4 deletions packages/figma-svg-extract-action/src/octokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ const pushToGithub = async ({
},
);

const newBranch = await octokit.request(
"POST /repos/{owner}/{repo}/git/refs",
const currentRef = await octokit.request(
"GET /repos/{owner}/{repo}/git/ref/{ref}",
{
owner,
repo,
ref: `refs/heads/${targetBranch}`,
ref: `heads/${targetBranch}`,
sha: commit.data.sha,
},
);

await octokit.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
owner,
repo,
ref: newBranch.data.ref,
ref: currentRef.data.ref,
sha: commit.data.sha,
});
};
Expand Down

0 comments on commit 3fa3c01

Please sign in to comment.