-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
linxin
committed
Oct 20, 2024
1 parent
4dee989
commit ee6b64a
Showing
5 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update SFC Companies List And Detail | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ids: | ||
description: "update SFC List with ids split by comma, e.g. 1,2,3" | ||
required: false | ||
repository_dispatch: | ||
types: | ||
- update_sfc_list | ||
|
||
jobs: | ||
export: | ||
name: Start update SFC Companies list | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
branch: main | ||
|
||
- uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Run update SFC Companies list and detail | ||
env: | ||
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | ||
SUPABASE_PASSWORD: ${{ secrets.SUPABASE_PASSWORD }} | ||
SUPABASE_EMAIL: ${{ secrets.SUPABASE_EMAIL }} | ||
run: | | ||
bun install | ||
bun run src/sites/hk_sfc/index.ts --ids=${{ inputs.ids }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
import yargs from "yargs"; | ||
import { hideBin } from "yargs/helpers"; | ||
import { HK_SFC } from "./entry"; | ||
import { uniq } from "lodash-es"; | ||
|
||
const hk_sfc = new HK_SFC(); | ||
|
||
hk_sfc.check_list(); | ||
// 使用 yargs 解析命令行参数 | ||
const argv = yargs(hideBin(process.argv)) | ||
.option("ids", { | ||
alias: "d", | ||
type: "string", | ||
describe: "JSON formatted data", | ||
coerce: (arg) => { | ||
try { | ||
return arg.split(",").filter(Boolean); | ||
} catch (e) { | ||
return []; | ||
} | ||
}, | ||
}) | ||
.help().argv; | ||
// @ts-ignore | ||
const init_ids = argv.ids || []; | ||
|
||
if (init_ids.length > 0) { | ||
hk_sfc.update_by_partial(uniq(init_ids).join(",")); | ||
} else { | ||
hk_sfc.check_list(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters