From cfddd9579c55f3a554aede192b8f6353a5a306a1 Mon Sep 17 00:00:00 2001
From: namidapoo <83203852+ve1997@users.noreply.github.com>
Date: Thu, 26 Dec 2024 10:03:03 +0900
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20Session=E3=82=92=E6=8B=A1=E5=BC=B5?=
=?UTF-8?q?=E3=81=97=E3=81=A6github=E3=81=AE=E3=82=A2=E3=82=AF=E3=82=BB?=
=?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=BC=E3=82=AF=E3=83=B3=E3=82=92=E5=8F=96?=
=?UTF-8?q?=E5=BE=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/page.tsx | 2 ++
lib/auth.ts | 21 +++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/app/page.tsx b/app/page.tsx
index 55854de..c0ee3bf 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -10,6 +10,8 @@ export default async function Home() {
const session = await auth();
if (!session?.user) return null;
+ console.log(session);
+
return (
diff --git a/lib/auth.ts b/lib/auth.ts
index 85c62c5..8e76153 100644
--- a/lib/auth.ts
+++ b/lib/auth.ts
@@ -3,9 +3,20 @@ import GitHub from "next-auth/providers/github";
import "next-auth/jwt";
export const { handlers, auth, signIn, signOut } = NextAuth({
- providers: [GitHub],
+ providers: [
+ GitHub({
+ authorization: {
+ param: {
+ scope: "repo read:user",
+ },
+ },
+ }),
+ ],
callbacks: {
- async jwt({ token, profile }) {
+ async jwt({ token, profile, account }) {
+ if (account) {
+ token.accessToken = account.access_token;
+ }
if (profile) {
const { login } = profile;
token.user = { ...token.user, login };
@@ -15,6 +26,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
async session({ session, token }) {
const { login } = token.user;
session.user = { ...session.user, login };
+ session.accessToken = token.accessToken;
return session;
},
},
@@ -24,6 +36,7 @@ declare module "next-auth" {
user: {
login: string;
} & DefaultSession["user"];
+ accessToken: string;
}
interface User {
login: string;
@@ -31,11 +44,15 @@ declare module "next-auth" {
interface Profile {
login: string;
}
+ interface Account {
+ access_token: string;
+ }
}
declare module "next-auth/jwt" {
interface JWT {
user: {
login: string;
};
+ accessToken: string;
}
}
From bf26a2963c4023dd157b350a7c3e931947732aec Mon Sep 17 00:00:00 2001
From: namidapoo <83203852+ve1997@users.noreply.github.com>
Date: Thu, 26 Dec 2024 10:12:02 +0900
Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E3=83=96=E3=83=A9=E3=83=B3=E3=83=81?=
=?UTF-8?q?=E5=90=8D=E3=81=AB=E3=81=8C`()`=E3=81=82=E3=82=8B=E3=81=A8?=
=?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC=E5=A4=B1?=
=?UTF-8?q?=E6=95=97=E3=81=99=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE?=
=?UTF-8?q?=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/deploy-info-comment-on-pr.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/deploy-info-comment-on-pr.yml b/.github/workflows/deploy-info-comment-on-pr.yml
index fc31e2d..4582642 100644
--- a/.github/workflows/deploy-info-comment-on-pr.yml
+++ b/.github/workflows/deploy-info-comment-on-pr.yml
@@ -19,7 +19,11 @@ jobs:
- name: Check if Deploy Workflow is Running
id: check_deploy
run: |
- runs=$(gh run list --branch ${{ github.head_ref }} --workflow "Deploy to Cloudflare Pages" --json status --jq '.[] | select(.status == "in_progress")')
+ runs=$(gh run list --branch "${{ github.head_ref }}" \
+ --workflow "Deploy to Cloudflare Pages" \
+ --json status \
+ --jq '.[] | select(.status == "in_progress")' 2>/dev/null)
+
if [[ -n "$runs" ]]; then
echo "Deploy workflow is currently running. Exiting."
echo "DEPLOY_STATUS=running" >> $GITHUB_ENV