Skip to content

Commit ace56d9

Browse files
Only create spaces for public repositories
1 parent 60ffe6f commit ace56d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ app.get("/github/:owner/:repo", async (req, res) => {
6565
repo,
6666
});
6767
ref = response.data.default_branch;
68+
// Is the repo public? If not, we stop here
69+
if (response.data.private) {
70+
res.status(403).send("Repository is private.");
71+
return;
72+
}
6873
} catch (error) {
6974
res.status(404).send("Repository not found.");
7075
return;
7176
}
7277
}
7378

74-
// Check if the user already has a code space for this repo,branch combination
79+
// Check if the user already has a code space for this repo, branch combination
7580
try {
7681
const response = await octokit.request('GET /repos/{owner}/{repo}/codespaces', {
7782
owner,

0 commit comments

Comments
 (0)