[[1,2], ['a','b']].flat(); // [1, 2, 'a', 'b']
[[1,2], ['a','b']].flat(2); // [1, 2, 'a', 'b']
[[1,2, ['a', ['a', ['a','b'],'b'],'b']], ['a','b']].flat(Infinity); // [1, 2, 'a', 'a', 'a', 'b', 'b', 'b', 'a', 'b']
jobs:
check-files-changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
changes: ${{ steps.changed-packages-name.outputs.result }}
steps:
- uses: actions/checkout@v4.1.7
- name: Получаем перечень изменённых файлов spfx пакетов
id: changed-files-specific
uses: tj-actions/changed-files@v44.5.7
with:
json: 'true'
dir_names: 'true'
files: monorepo/spfx-packages/**
files_ignore: monorepo/spfx-packages/**/*.md
- name: Получаем имена изменённых spfx пакетов
id: changed-packages-name
uses: actions/github-script@v7.0.1
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
with:
script: |
const getChangedPackagesOrLibs = require('./.gitea/scripts/js/getChangedPackagesOrLibs.js');
return getChangedPackagesOrLibs('spfx-packages');
// ./.gitea/scripts/js/getChangedPackagesOrLibs.js
/**
* Возвращает массив имён изменённых пакетов или библиотек.
*
* @param {(libs|spfx-packages)} type - Тип: библиотека или spfx-пакет
* @return {Promise<string[]>} - Массив имён изменённых пакетов или библиотек
*/
module.exports = (type) => {
const { ALL_CHANGED_FILES } = process.env;
const changedDirPaths = JSON.parse(JSON.parse(`"${ALL_CHANGED_FILES}"`));
const regex = new RegExp(`(monorepo\/${type}\/)([^\/]+)(.+)?`, 'gm');
const parentDirPaths = [
...(new Set(
changedDirPaths
.map((dirPath) => dirPath.replace(regex, '$2'))
))
];
return parentDirPaths;
}
[
"monorepo/spfx-packages/news/src/webparts/news",
"monorepo/spfx-packages/news/config",
"monorepo/spfx-packages/news",
"monorepo/spfx-packages/news/src/webparts/news/loc",
"monorepo/spfx-packages/alert/src/webparts/alert",
"monorepo/spfx-packages/alert/config",
"monorepo/spfx-packages/alert",
"monorepo/spfx-packages/alert/src/webparts/alert/loc"
]
[
"news",
"alert"
]
может мне проще удалить Git?