From 5961708c566a2017bcb2c43cff11dbbfed18ca87 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 23 May 2023 07:00:43 -0500 Subject: [PATCH] feat: add vueconf repo invite automation --- .../routes/auth/github/{cityjs.get.ts => vueconf.ts} | 9 ++++----- src/server/routes/{cityjs.get.ts => vueconf.get.ts} | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) rename src/server/routes/auth/github/{cityjs.get.ts => vueconf.ts} (88%) rename src/server/routes/{cityjs.get.ts => vueconf.get.ts} (69%) diff --git a/src/server/routes/auth/github/cityjs.get.ts b/src/server/routes/auth/github/vueconf.ts similarity index 88% rename from src/server/routes/auth/github/cityjs.get.ts rename to src/server/routes/auth/github/vueconf.ts index 19efac67..937bd9fe 100644 --- a/src/server/routes/auth/github/cityjs.get.ts +++ b/src/server/routes/auth/github/vueconf.ts @@ -1,5 +1,7 @@ /* eslint-disable camelcase */ +const repo = 'danielroe/nailing-it-vueconf-us-2023' + export default defineEventHandler(async event => { const { code } = getQuery(event) @@ -50,7 +52,7 @@ export default defineEventHandler(async event => { try { const res = await $fetch( - `https://api.github.com/repos/danielroe/nailing-it-cityjs-2023/collaborators/${username}`, + `https://api.github.com/repos/${repo}/collaborators/${username}`, { method: 'PUT', body: { permission: 'push' }, @@ -65,8 +67,5 @@ export default defineEventHandler(async event => { } catch (err) { console.log('could not add collaborator', err) } - return sendRedirect( - event, - 'https://github.com/danielroe/nailing-it-cityjs-2023/invitations' - ) + return sendRedirect(event, `https://github.com/${repo}/invitations`) }) diff --git a/src/server/routes/cityjs.get.ts b/src/server/routes/vueconf.get.ts similarity index 69% rename from src/server/routes/cityjs.get.ts rename to src/server/routes/vueconf.get.ts index 55bba506..d0e3aec0 100644 --- a/src/server/routes/cityjs.get.ts +++ b/src/server/routes/vueconf.get.ts @@ -1,6 +1,6 @@ const redirect = process.dev - ? '&redirect_uri=http://localhost:3000/auth/github/cityjs' - : '&redirect_uri=https://roe.dev/auth/github/cityjs' + ? '&redirect_uri=http://localhost:3000/auth/github/vueconf' + : '&redirect_uri=https://roe.dev/auth/github/vueconf' const config = useRuntimeConfig() const loginURL = `https://github.com/login/oauth/authorize?client_id=${config.public.githubClientId}${redirect}` -- knotmirror 0.0.1