Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mahmudjontoraqulov
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmudjonToraqulov committed Mar 29, 2024
2 parents 84a90b4 + 5a8cb7f commit 4aed738
Show file tree
Hide file tree
Showing 807 changed files with 76,886 additions and 103,648 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const restrictedImportPaths = [
name: '@styles/theme/illustrations',
message: 'Do not import theme illustrations directly. Please use the `useThemeIllustrations` hook instead.',
},
{
name: 'date-fns/locale',
message: "Do not import 'date-fns/locale' directly. Please use the submodule import instead, like 'date-fns/locale/en-GB'.",
},
];

const restrictedImportPatterns = [
Expand Down Expand Up @@ -115,6 +119,7 @@ module.exports = {
// This path is provide alias for files like `ONYXKEYS` and `CONST`.
'@src': './src',
'@desktop': './desktop',
'@github': './.github',
},
},
],
Expand Down
44 changes: 22 additions & 22 deletions .github/actions/javascript/authorChecklist/authorChecklist.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as core from '@actions/core';
import * as github from '@actions/github';
import escapeRegExp from 'lodash/escapeRegExp';
import CONST from '../../../libs/CONST';
import GithubUtils from '../../../libs/GithubUtils';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
import newComponentCategory from './categories/newComponentCategory';

const pathToAuthorChecklist = `https://raw.githubusercontent.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}/main/.github/PULL_REQUEST_TEMPLATE.md`;
Expand All @@ -20,24 +21,24 @@ const CHECKLIST_CATEGORIES = {
*/
async function getChecklistCategoriesForPullRequest(): Promise<Set<string>> {
const checks = new Set<string>();
const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
// eslint-disable-next-line @typescript-eslint/naming-convention
pull_number: prNumber,
// eslint-disable-next-line @typescript-eslint/naming-convention
per_page: 100,
});
const possibleCategories = await Promise.all(
Object.values(CHECKLIST_CATEGORIES).map(async (category) => ({
items: category.items,
doesCategoryApply: await category.detect(changedFiles),
})),
);
for (const category of possibleCategories) {
if (category.doesCategoryApply) {
for (const item of category.items) {
checks.add(item);
if (prNumber !== undefined) {
const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
pull_number: prNumber,
per_page: 100,
});
const possibleCategories = await Promise.all(
Object.values(CHECKLIST_CATEGORIES).map(async (category) => ({
items: category.items,
doesCategoryApply: await category.detect(changedFiles),
})),
);
for (const category of possibleCategories) {
if (category.doesCategoryApply) {
for (const item of category.items) {
checks.add(item);
}
}
}
}
Expand Down Expand Up @@ -126,12 +127,11 @@ async function generateDynamicChecksAndCheckForCompletion() {
const newBody = contentBeforeChecklist + checklistStartsWith + checklist + checklistEndsWith + contentAfterChecklist;

// Update the PR body
if (didChecklistChange) {
if (didChecklistChange && prNumber !== undefined) {
console.log('Checklist changed, updating PR...');
await GithubUtils.octokit.pulls.update({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
// eslint-disable-next-line @typescript-eslint/naming-convention
pull_number: prNumber,
body: newBody,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import github from '@actions/github';
import {parse} from '@babel/parser';
import traverse from '@babel/traverse';
import CONST from '../../../../libs/CONST';
import GithubUtils from '../../../../libs/GithubUtils';
import promiseSome from '../../../../libs/promiseSome';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
import promiseSome from '@github/libs/promiseSome';
import type Category from './Category';

type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string};
Expand Down Expand Up @@ -81,7 +81,7 @@ async function detectReactComponentInFile(filename: string): Promise<boolean | u
};
try {
const {data} = await GithubUtils.octokit.repos.getContent(params);
const content = 'content' in data ? nodeBase64ToUtf8(data.content || '') : data;
const content = nodeBase64ToUtf8('content' in data ? data?.content ?? '' : '');
return detectReactComponent(content, filename);
} catch (error) {
console.error('An unknown error occurred with the GitHub API: ', error, params);
Expand Down
Loading

0 comments on commit 4aed738

Please sign in to comment.