Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
2 changes: 1 addition & 1 deletion .github/workflows/cd.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
node-version: "20"
os: "ubuntu-latest"

bundle-deploy:
docker-build-push-api:
needs: build
runs-on: ubuntu-latest
env:
Expand Down
22 changes: 15 additions & 7 deletions api/src/digest/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ it may contain non-translatable parts like acronyms, keep them as is.`;
name_ar,
};
const [{ id: projectId }] = await this.projectsRepository.upsert(projectEntity);
for (const tagId of project.tags || []) {
await this.tagRepository.upsert({ id: tagId, runId });
await this.projectsRepository.upsertRelationWithTag({ projectId, tagId, runId });
}
await this.searchService.upsert("project", projectEntity);

let addedRepositoryCount = 0;
try {
Expand Down Expand Up @@ -294,8 +289,19 @@ it may contain non-translatable parts like acronyms, keep them as is.`;
if (addedRepositoryCount === 0) {
captureException(new Error("Empty project"), { extra: { project } });
await this.projectsRepository.deleteRelationWithTagByProjectId(projectId);
await this.projectsRepository.deleteById(projectId);
await this.projectsRepository.upsert({ ...projectEntity, runId: "garbage-collected" });
continue;
}

for (const tagId of project.tags || []) {
await this.tagRepository.upsert({ id: tagId, runId });
await this.projectsRepository.upsertRelationWithTag({
projectId,
tagId,
runId,
});
}
await this.searchService.upsert("project", projectEntity);
}

try {
Expand Down Expand Up @@ -373,7 +379,9 @@ it may contain non-translatable parts like acronyms, keep them as is.`;
repoContributors
.filter(({ type }) => type === "User")
.map(async (contributor) => {
const userInfo = await this.githubService.getUser({ username: contributor.login });
const userInfo = await this.githubService.getUser({
username: contributor.login,
});
Comment thread
ZibanPirate marked this conversation as resolved.
Outdated
return {
id: contributor.login,
name: userInfo.name,
Expand Down
4 changes: 4 additions & 0 deletions api/src/fetch/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class FetchService {
private async fetch<T>(url: string, options: FetchOptions) {
this.logger.info({ message: `Fetching ${url}` });
const response = await this.makeFetchHappenInstance(url, options);
if (!response.ok) {
this.logger.error({ message: `Failed to fetch ${url}`, meta: { status: response.status } });
throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
}
const jsonResponse = (await response.json()) as T;
Comment thread
ZibanPirate marked this conversation as resolved.
return jsonResponse;
}
Expand Down
5 changes: 3 additions & 2 deletions data/models/projects/SPL_Router/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"provider": "github",
"owner": "Mouhamedtec",
"repository": "SPL-Router"
"name": "SPL-Router"
}
]
],
"tags": ["by-algerian"]
}
Loading