mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-22 12:21:17 +01:00
fix: persist pull request conferences and reconcile runtime tests
This commit is contained in:
1 parent
fd0dd0adbd
commit
b09ef0e5b0
7 files changed
+279
-1
No files matched your search
@@ -0,0 +1,5 @@
|
||||
export function joinUrl(base: string, pathname: string): string {
|
||||
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
||||
const normalizedPath = pathname.replace(/^\/+/, "");
|
||||
return new URL(normalizedPath, normalizedBase).toString();
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
/* global module, require */
|
||||
require("ts-node/register/transpile-only");
|
||||
module.exports = require("./downloadRepository.ts").default;
|
||||
@@ -0,0 +1,3 @@
|
||||
/* global module, require */
|
||||
require("ts-node/register/transpile-only");
|
||||
module.exports = require("./removeCache.ts").default;
|
||||
@@ -0,0 +1,3 @@
|
||||
/* global module, require */
|
||||
require("ts-node/register/transpile-only");
|
||||
module.exports = require("./removeRepository.ts").default;
|
||||
@@ -0,0 +1,27 @@
|
||||
import { existsSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
|
||||
const PROCESSOR_PATHS = {
|
||||
downloadRepository: {
|
||||
build: resolve("build/queue/processes/downloadRepository.js"),
|
||||
source: resolve("src/queue/processes/downloadRepository.worker.js"),
|
||||
},
|
||||
removeCache: {
|
||||
build: resolve("build/queue/processes/removeCache.js"),
|
||||
source: resolve("src/queue/processes/removeCache.worker.js"),
|
||||
},
|
||||
removeRepository: {
|
||||
build: resolve("build/queue/processes/removeRepository.js"),
|
||||
source: resolve("src/queue/processes/removeRepository.worker.js"),
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type WorkerProcessorName = keyof typeof PROCESSOR_PATHS;
|
||||
|
||||
export function resolveWorkerProcessorPath(
|
||||
name: WorkerProcessorName,
|
||||
fileExists: (path: string) => boolean = existsSync
|
||||
): string {
|
||||
const processor = PROCESSOR_PATHS[name];
|
||||
return fileExists(processor.build) ? processor.build : processor.source;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ router.post("/", async (req, res) => {
|
||||
pullRequest.source.repositoryFullName =
|
||||
pullRequestUpdate.source.repositoryFullName;
|
||||
|
||||
pullRequest.conference = pullRequestUpdate.conference;
|
||||
pullRequest.model.conference = pullRequestUpdate.conference;
|
||||
|
||||
await pullRequest.model.save();
|
||||
await pullRequest.anonymize();
|
||||
|
||||
Reference in new issue
Block a user