Skip to content

Commit

Permalink
Existing check: multiple base URL and duplicate label (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenyomi authored Apr 6, 2023
1 parent 7ce070a commit 5ba9cd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/feature/existing-source-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as github from '@actions/github';
import { Issue, IssuesEvent } from '@octokit/webhooks-definitions/schema';
import axios from 'axios';

import { shouldIgnore } from '../util/issues';
import { addDuplicateLabel, shouldIgnore } from '../util/issues';
import { cleanUrl, urlsFromIssueBody } from '../util/urls';

interface Extension {
Expand Down Expand Up @@ -71,8 +71,11 @@ export async function checkForExistingSource() {
}

const requestUrl = cleanUrl(issueUrls[0]);
const isRequestUrl = (url: string) => cleanUrl(url) === requestUrl;
const existingExtension = repository.find((extension) =>
extension.sources.find((source) => cleanUrl(source.baseUrl) === requestUrl),
extension.sources.some((source) =>
source.baseUrl.split(', ').some(isRequestUrl),
),
);
if (!existingExtension) {
core.info(`Existing extension with the URL "${requestUrl}" was not found.`);
Expand All @@ -94,6 +97,7 @@ export async function checkForExistingSource() {
const extensionName = existingExtension.name.replace('Tachiyomi: ', '');
const extensionLang = findLangName(existingExtension.lang);

await addDuplicateLabel(client, issueMetadata);
await client.rest.issues.update({
...issueMetadata,
state: 'closed',
Expand Down

0 comments on commit 5ba9cd0

Please sign in to comment.