Skip to content

Commit 284085e

Browse files
committed
Fixes to github url for fetching CI status
1 parent 42b0559 commit 284085e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/deploy-catalog-analytics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
--min-instances=0 \
112112
--concurrency=80 \
113113
--port=8080 \
114-
--set-env-vars="NODE_ENV=production,NEXT_PUBLIC_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }},GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }},SESSION_SECRET=${{ secrets.SESSION_SECRET }},NEXT_PUBLIC_APP_URL=https://catalog.vectorinstitute.ai,REDIRECT_URI=https://catalog.vectorinstitute.ai/analytics/api/auth/callback,ALLOWED_DOMAINS=vectorinstitute.ai" \
114+
--set-env-vars="NODE_ENV=production,NEXT_PUBLIC_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }},GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }},SESSION_SECRET=${{ secrets.SESSION_SECRET }},METRICS_GITHUB_TOKEN=${{ secrets.METRICS_GITHUB_TOKEN }},NEXT_PUBLIC_APP_URL=https://catalog.vectorinstitute.ai,REDIRECT_URI=https://catalog.vectorinstitute.ai/analytics/api/auth/callback,ALLOWED_DOMAINS=vectorinstitute.ai" \
115115
--update-labels="deployed-by=github-actions,commit=${{ github.sha }},service=catalog-analytics" \
116116
--quiet
117117

catalog-analytics/app/api/github/ci-status/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export async function POST(request: Request) {
8080
try {
8181
// First, get the latest commit SHA on main branch
8282
// Use URL constructor to prevent SSRF
83-
const branchUrl = buildGitHubApiUrl(`/repos/${encodeURIComponent(repoIdStr)}/branches/main`);
83+
// Note: Don't use encodeURIComponent on repo_id since it would encode the '/' separator
84+
// We've already validated repo_id format with isValidRepoId()
85+
const branchUrl = buildGitHubApiUrl(`/repos/${repoIdStr}/branches/main`);
8486
const branchResponse = await fetch(
8587
branchUrl.toString(),
8688
{
@@ -121,7 +123,8 @@ export async function POST(request: Request) {
121123

122124
// Now get check runs for this specific commit
123125
// Use URL constructor to prevent SSRF
124-
const checksUrl = buildGitHubApiUrl(`/repos/${encodeURIComponent(repoIdStr)}/commits/${latestCommitSha}/check-runs`);
126+
// Note: Don't use encodeURIComponent on repo_id since it would encode the '/' separator
127+
const checksUrl = buildGitHubApiUrl(`/repos/${repoIdStr}/commits/${latestCommitSha}/check-runs`);
125128
const checksResponse = await fetch(
126129
checksUrl.toString(),
127130
{

0 commit comments

Comments
 (0)