Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/services/db/GitHubService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import logger from "@root/logger/logger"
import { GitCommitResult } from "@root/types/gitfilesystem"
import { GitHubRepoInfo, RawGitTreeEntry, RepoState } from "@root/types/github"

import { E2E_TEST_GH_TOKEN } from "../middlewareServices/AuthenticationMiddlewareService"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually have this token at run time or is it only during e2e on local

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run time - we currently also use it for pr approval

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but The name of the token is very misleading


import * as ReviewApi from "./review"

export default class GitHubService {
Expand Down Expand Up @@ -861,9 +863,9 @@ export default class GitHubService {
const endpointTemplate = urlTemplate.parse(`{siteName}`)
const endpoint = endpointTemplate.expand({ siteName })

// Privatising a repo is restricted to repo admins - an admin token will be inserted in via our axios interceptor
// Privatising a repo is restricted to repo admins - our main admin token is used
const headers = {
Authorization: "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this was previously empty? Comment seems to say this was injected by the axios interceptor

If we are modifying to inject token here is the interceptor still needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interceptor always exists, and inserts in the token in cases where it doesn't exist (i.e. all email login actions). normally this is just to catch the github flow, where the user's personal github token wold be used (but they would lack perms)

In this case we're using the admin token for both flows, so no change

Authorization: `token ${E2E_TEST_GH_TOKEN}`,
"Content-Type": "application/json",
}

Expand Down
Loading