Skip to content

Commit e04dc8f

Browse files
authored
[torchagent] add username to lambda call (#6776)
To store history later on. Note username is only injected @ api level, so can't be adjusted from the frontend
1 parent 47891fd commit e04dc8f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torchci/pages/api/grafana_mcp/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default async function handler(
4949
// write permissions to the main PyTorch repository
5050
const repoOwner = "pytorch";
5151
const repoName = "pytorch";
52+
let username: string;
5253

5354
try {
5455
const octokit = await getOctokitWithUserToken(
@@ -78,6 +79,9 @@ export default async function handler(
7879
}
7980

8081
console.log(`Authorized: User ${user.data.login} has write permissions`);
82+
83+
// Store username for use in lambda request
84+
username = user.data.login;
8185
} catch (error) {
8286
console.error("Error checking permissions:", error);
8387
return res.status(500).json({ error: "Permission check failed" });
@@ -142,6 +146,7 @@ export default async function handler(
142146
body: JSON.stringify({
143147
query: query,
144148
userUuid: userUuid,
149+
username: username,
145150
}),
146151
});
147152

0 commit comments

Comments
 (0)