Skip to content

Commit

Permalink
console.github response
Browse files Browse the repository at this point in the history
  • Loading branch information
dogfrogfog committed Nov 17, 2023
1 parent 68e1da7 commit 5d9abcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/api/roll-out/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function POST(request: Request) {
});

if (projectData) {
await triggerGithubWorkflow({
const result = await triggerGithubWorkflow({
sanityProjectId,
sanityDatasetName,
vercelProjectId: projectData.projectId,
Expand All @@ -37,7 +37,9 @@ export async function POST(request: Request) {
email,
});

return new Response('All steps were successful 🎉', { status: 200 });
if (result === true) {
return new Response('All steps were successful 🎉', { status: 200 });
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions lib/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,15 @@ export async function triggerGithubWorkflow({
},
);

console.log(response.json());

if (response.status === 401) {
throw new Error('Invalid github token');
}

console.log('Github workflow triggered...✅');

return true;
} catch (e) {
console.log(e);
}
Expand Down

0 comments on commit 5d9abcc

Please sign in to comment.