Skip to content

Commit

Permalink
Imported resurse crestine songs based on rc_authors_to_process.txt an…
Browse files Browse the repository at this point in the history
…d rc_ids_to_process.txt.
  • Loading branch information
ioanlucut committed Oct 2, 2023
1 parent adc8e42 commit b357e73
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 19 deletions.
55 changes: 54 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
name: 'CI (Continuous Integration) & Auto Update Songs Meta'

on: [pull_request]
on: [ pull_request ]

jobs:
PathsFilter:
runs-on: ubuntu-latest
outputs:
rcOutput: ${{ steps.filter.outputs.rcImportsHaveChanged }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: dorny/paths-filter@v2
id: filter
with:
path: bes-lyrics
filters: |
rcImportsHaveChanged:
- 'temp_runners/**/*.txt'
Build:
needs: PathsFilter
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
path: bes-lyrics

- name: Use Node.js 20.x
uses: actions/setup-node@v3
Expand All @@ -25,6 +45,38 @@ jobs:
CI: true
FORCE_COLOR: 2

AutoImportFromRC:
needs: [ Build, PathsFilter ]
runs-on: ubuntu-latest
if: needs.PathsFilter.outputs.rcOutput == 'true'
steps:
- name: Checkout bes-lyrics-parser repo
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_BES_PROJECTS }}
repository: ioanlucut/bes-lyrics-parser
path: bes-lyrics-parser
sparse-checkout: |
out
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Import from RC (if not exists already)
working-directory: ./bes-lyrics
run: |
npm i && npm run import:rc:ci
git config user.name github-actions
git config user.email [email protected]
git add -A
git diff --quiet && git diff --staged --quiet || git commit -am "[Bot] I have imported the resurse crestine songs based on the rc_authors_to_process.txt and rc_ids_to_process.txt."
git push
env:
CI: true
FORCE_COLOR: 2

AutoUpdateMeta:
needs: Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,6 +104,7 @@ jobs:
>
>
skip-checks: true"
git push
env:
CI: true
FORCE_COLOR: 2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"reprocess:filename": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./bin/lyricsFileNameReprocessorRunner.ts",
"import:rc:by-authors": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByAuthors.ts",
"import:rc:by-ids": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByIds.ts",
"import:rc:ci": "npm run import:rc:by-authors && npm run import:rc:by-ids",
"import:rc:ci": "npm run import:rc:by-authors && npm run import:rc:by-ids && npm run reprocess:filename && npm run reprocess:content && npm run format",
"build:ci": "npm run lint && npm run test && npm run verify",
"meta:ci": "npm run reprocess:filename && npm run reprocess:content && npm run verify && npm run format"
},
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export * from './types.js';
export * as contentReplacerReprocessor from './contentReplacerReprocessor.js';
export * as contentStructureReprocessor from './contentStructureReprocessor.js';
export * as lyricsFileNameReprocessor from './lyricsFileNameReprocessor.js';
export * from './charsStatsCollector.js';
export * from './constants.js';
export * from './contentStructureValidator.js';
export * from './core.js';
export * from './constants.js';
export * as lyricsFileNameReprocessor from './lyricsFileNameReprocessor.js';
export * as contentStructureReprocessor from './contentStructureReprocessor.js';
export * as contentReplacerReprocessor from './contentReplacerReprocessor.js';
export * from './songParser.js';
export * from './songPrinter.js';
export * from './types.js';
16 changes: 9 additions & 7 deletions temp-runners/importSongsFromRcByAuthors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ import recursive from 'recursive-readdir';
import pMap from 'p-map';
import { flatten } from 'lodash-es';
import { fileURLToPath } from 'url';
import { parse } from '../src/songParser.js';
import { print } from '../src/songPrinter.js';
import {
COLON,
logFileWithLinkInConsole,
logProcessingFile,
NEW_LINE,
parse,
print,
} from '../src/index.js';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

dotenv.config();

const RC_BASE = '/Users/ilucut/WORK/BES/bes-lyrics-parser';
const RC_DIR = `${RC_BASE}/out/resurse_crestine`;
const CANDIDATES_DIR = `/Users/ilucut/WORK/BES/bes-lyrics/candidates`;
const RC_DIR = `${path.join(
__dirname,
'../../',
'bes-lyrics-parser',
)}/out/resurse_crestine`;

const CANDIDATES_DIR = './candidates';

const rcAuthorPathsToProcess = fsExtra
.readFileSync(`${__dirname}/rc_authors_to_process.txt`)
Expand Down Expand Up @@ -67,8 +71,6 @@ const runFor = async (songsDirs: string[]) => {
console.log(
`Skip processing the song with RC ID ${rcSongAST.rcId} as we have it in our system.`,
);
console.log(NEW_LINE);

return;
}

Expand Down
9 changes: 4 additions & 5 deletions temp-runners/importSongsFromRcByIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ import recursive from 'recursive-readdir';
import pMap from 'p-map';
import { first, flatten } from 'lodash-es';
import { fileURLToPath } from 'url';
import { parse } from '../src/songParser.js';
import { print } from '../src/songPrinter.js';
import {
COLON,
logFileWithLinkInConsole,
logProcessingFile,
NEW_LINE,
parse,
print,
} from '../src/index.js';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

dotenv.config();

const IN_LYRICS_PARSER = '../bes-lyrics-parser';
const IN_LYRICS_PARSER = path.join(__dirname, '../../', 'bes-lyrics-parser');
const IN_LYRICS_PARSER_GENERATED_RC_SONGS = `${IN_LYRICS_PARSER}/out/resurse_crestine`;

const OUT_CANDIDATES_RC_DIR = './candidates/resurse_crestine_raw';

const RC_IDS_TO_PROCESS = fsExtra
Expand Down Expand Up @@ -73,8 +74,6 @@ const runFor = async (songsDirs: string[]) => {
console.log(
`Skip processing the song with RC ID ${rcSongAST.rcId} as we have it in our system.`,
);
console.log(NEW_LINE);

return;
}

Expand Down

0 comments on commit b357e73

Please sign in to comment.