diff options
author | Michael C <[email protected]> | 2021-11-30 16:44:42 -0500 |
---|---|---|
committer | Michael C <[email protected]> | 2021-11-30 18:17:28 -0500 |
commit | dc47b9ffd2049e8a11e566dbf2753fbe59e17465 (patch) | |
tree | 842914e8fd12dfb2ec21b9f84e623482ac08e084 | |
parent | e4e453a11c776bb4127e07252f868c3e54e3e386 (diff) | |
download | SponsorBlock-dc47b9ffd2049e8a11e566dbf2753fbe59e17465.tar.gz SponsorBlock-dc47b9ffd2049e8a11e566dbf2753fbe59e17465.zip |
appease CI/ webpack
move to ci/
change triggers
-rw-r--r-- | .github/workflows/updateInvidous.yml | 32 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | ci/invidiousCI.ts (renamed from src/ci/invidiousCI.ts) | 9 | ||||
-rw-r--r-- | ci/invidiouslist.json (renamed from src/ci/invidiouslist.json) | 0 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/config.ts | 2 |
6 files changed, 42 insertions, 5 deletions
diff --git a/.github/workflows/updateInvidous.yml b/.github/workflows/updateInvidous.yml new file mode 100644 index 00000000..f43142c7 --- /dev/null +++ b/.github/workflows/updateInvidous.yml @@ -0,0 +1,32 @@ +name: update invidious +on: + workflow_dispatch: + schedule: + - cron: '0 0 1 * *' # check every month + +jobs: + check-list: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download instance list + run: | + wget https://api.invidious.io/instances.json -O data.json + - name: "Run CI" + run: npm run ci:invidious + - name: setup git config + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + - name: "Commit new files" + run : | + if [ $(git status --porcelain=v1 2>/dev/null | wc -l) -ge 1 ] + then + echo "pushing changes" + git add invidiouslist.json + git commit -m "[CI] New Invidious List" + git push origin main + else + echo "no changes" + fi
\ No newline at end of file @@ -7,4 +7,4 @@ web-ext-artifacts dist/ tmp/ .DS_Store -src/ci/data.json
\ No newline at end of file +ci/data.json
\ No newline at end of file diff --git a/src/ci/invidiousCI.ts b/ci/invidiousCI.ts index 2c4a8089..05cf8f8f 100644 --- a/src/ci/invidiousCI.ts +++ b/ci/invidiousCI.ts @@ -4,10 +4,15 @@ This file is only ran by GitHub Actions in order to populate the Invidious insta This file should not be shipped with the extension */ -import { writeFile } from 'fs'; +import { writeFile, existsSync } from 'fs'; import { join } from 'path'; -// import file downloade from https://api.invidious.io/instances.json +// import file from https://api.invidious.io/instances.json +if (!existsSync('./data.json')) { + process.exit(1); +} +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import * as data from "./data.json"; type instanceMap = { diff --git a/src/ci/invidiouslist.json b/ci/invidiouslist.json index 905605d8..905605d8 100644 --- a/src/ci/invidiouslist.json +++ b/ci/invidiouslist.json diff --git a/package.json b/package.json index 963c1203..62153f13 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "build:watch": "npm run build:watch:chrome", "build:watch:chrome": "webpack --env.browser=chrome --config webpack/webpack.dev.js --watch", "build:watch:firefox": "webpack --env.browser=firefox --config webpack/webpack.dev.js --watch", - "ci:invidious": "ts-node src/ci/invidiousCI.ts", + "ci:invidious": "ts-node ci/invidiousCI.ts", "dev": "npm run build:dev && concurrently \"npm run web-run\" \"npm run build:watch\"", "dev:firefox": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox\" \"npm run build:watch:firefox\"", "dev:firefox-android": "npm run build:dev:firefox && concurrently \"npm run web-run:firefox-android\" \"npm run build:watch:firefox\"", diff --git a/src/config.ts b/src/config.ts index 912f87dc..814e95a6 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,5 +1,5 @@ import * as CompileConfig from "../config.json"; -import * as invidiousList from "../src/ci/invidiouslist.json"; +import * as invidiousList from "../ci/invidiouslist.json"; import { Category, CategorySelection, CategorySkipOption, NoticeVisbilityMode, PreviewBarOption, SponsorTime, StorageChangesObject, UnEncodedSegmentTimes as UnencodedSegmentTimes } from "./types"; interface SBConfig { |