add npm scripts

This commit is contained in:
Viet Huynh
2023-09-29 06:18:30 +07:00
parent 862dcb15bb
commit da02a966fb
2 changed files with 19 additions and 10 deletions
+6 -10
View File
@@ -33,20 +33,18 @@ jobs:
- name: Install npm dependencies - name: Install npm dependencies
run: npm ci run: npm ci
- name: Download recommended whitelist - name: Download allowlists
run: bash ./get_recommended_whitelist.sh run: npm run download:allowlist
env: env:
ALLOWLIST_URLS: ${{ vars.ALLOWLIST_URLS }} ALLOWLIST_URLS: ${{ vars.ALLOWLIST_URLS }}
- name: Download recommended filters - name: Download blocklists
run: bash ./get_recommended_filters.sh run: npm run download:blocklist
env: env:
BLOCKLIST_URLS: ${{ vars.BLOCKLIST_URLS }} BLOCKLIST_URLS: ${{ vars.BLOCKLIST_URLS }}
- name: Delete old rules and lists - name: Delete old rules and lists
run: | run: npm run cloudflare-delete
node cf_gateway_rule_delete.js
node cf_list_delete.js
env: env:
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
CLOUDFLARE_ACCOUNT_EMAIL: ${{ secrets.CLOUDFLARE_ACCOUNT_EMAIL }} CLOUDFLARE_ACCOUNT_EMAIL: ${{ secrets.CLOUDFLARE_ACCOUNT_EMAIL }}
@@ -55,9 +53,7 @@ jobs:
FAST_MODE: ${{ vars.FAST_MODE }} FAST_MODE: ${{ vars.FAST_MODE }}
- name: Create new rules and lists - name: Create new rules and lists
run: | run: npm run cloudflare-create
node cf_list_create.js
node cf_gateway_rule_create.js
env: env:
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
CLOUDFLARE_ACCOUNT_EMAIL: ${{ secrets.CLOUDFLARE_ACCOUNT_EMAIL }} CLOUDFLARE_ACCOUNT_EMAIL: ${{ secrets.CLOUDFLARE_ACCOUNT_EMAIL }}
+13
View File
@@ -1,4 +1,17 @@
{ {
"scripts": {
"start": "npm run download && npm run cloudflare-delete && npm run cloudflare-create",
"dry": "npm run download && DRY_RUN=1 npm run cloudflare-create:list",
"download": "node download_lists.js",
"download:allowlist": "node download_lists.js allowlist",
"download:blocklist": "node download_lists.js blocklist",
"cloudflare-create": "npm run create:list && npm run create:rule",
"cloudflare-delete": "npm run delete:rule && npm run delete:list",
"cloudflare-create:rule": "node cf_gateway_rule_create.js",
"cloudflare-create:list": "node cf_list_create.js",
"cloudflare-delete:rule": "node cf_gateway_rule_delete.js",
"cloudflare-delete:list": "node cf_list_delete.js"
},
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"dotenv": "^16.0.3", "dotenv": "^16.0.3",