Skip to content

Commit

Permalink
feat: progress-bar and commit for first pr
Browse files Browse the repository at this point in the history
  • Loading branch information
srijitcoder committed Oct 17, 2024
1 parent 5bfada1 commit 00cfc85
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 2 deletions.
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"node": ">=20.0.0"
},
"dependencies": {
"@aacassandra/vue3-progressbar": "^1.0.3",
"@primer/octicons": "^19.11.0",
"dayjs": "^1.11.13",
"octokit": "^4.0.2",
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ provide("set-nav-button-config", navButtonConfig);

<template>
<v-app>
<vue-progress-bar></vue-progress-bar>
<Navbar />
<v-main>
<RouterView />
Expand Down
28 changes: 26 additions & 2 deletions src/api/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,38 @@ export async function createSession(octokit, githubConfig, name) {
});
const latestCommitSha = defaultBranchRef.object.sha;

await octokit.rest.git.createRef({
const { data: latestCommit } = await octokit.rest.git.getCommit({
owner: githubConfig.username,
repo: githubConfig.repo,
commit_sha: latestCommitSha,
});
const treeSha = latestCommit.tree.sha;

const t = await octokit.rest.git.createRef({
owner: githubConfig.username,
repo: githubConfig.repo,
ref: `refs/heads/${branchName}`,
sha: latestCommitSha,
});

const { data: pullRequest } = await octokit.rest.pulls.create({
const emptyCommitMessage = "chore: create session using empty commit";
const { data: commit } = await octokit.rest.git.createCommit({
owner: githubConfig.username,
repo: githubConfig.repo,
message: emptyCommitMessage,
tree: treeSha,
parents: [latestCommitSha],
});

await octokit.rest.git.updateRef({
owner: githubConfig.username,
repo: githubConfig.repo,
ref: `heads/${branchName}`,
sha: commit.sha,
force: true,
});

await octokit.rest.pulls.create({
owner: githubConfig.username,
repo: githubConfig.repo,
title: name,
Expand Down
14 changes: 14 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@ import { createApp } from "vue";
import App from "./App.vue";
import router from "@/router";
import vuetify from "@/plugins/vuetify";
import VueProgressBar from "@aacassandra/vue3-progressbar";

const app = createApp(App);

app.use(vuetify);
app.use(VueProgressBar, {
color: "#D6EEFF",
failedColor: "#874b4b",
thickness: "2px",
transition: {
speed: "0.2s",
opacity: "0.6s",
termination: 300,
},
autoRevert: true,
location: "top",
inverse: false,
});
app.use(router);
app.mount("#app");

0 comments on commit 00cfc85

Please sign in to comment.