Merge pull request #192 from movie-web/fix-ci-lineendings

update linting ci
This commit is contained in:
mrjvs 2023-03-10 19:28:26 +01:00 committed by GitHub
commit dd662efd72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 15 deletions

49
.github/workflows/linting_annotate.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Annotate linting
permissions:
actions: read # download artifact
checks: write # annotate
# this is done as a seperate workflow so
# the annotater has access to write to checks (to annotate)
on:
workflow_run:
workflows: ["Linting and Testing"]
types:
- completed
jobs:
annotate:
runs-on: ubuntu-latest
steps:
- name: Download linting report
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "eslint_report.json"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/eslint_report.zip', Buffer.from(download.data));
- run: unzip eslint_report.zip
- run: ls -la
- name: Annotate linting
uses: ataylorme/eslint-annotate-action@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "eslint_report.json"

View File

@ -5,8 +5,7 @@ on:
branches: branches:
- master - master
- dev - dev
pull_request_target: pull_request:
types: [opened, reopened, synchronize]
jobs: jobs:
linting: linting:
@ -21,6 +20,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
cache: 'yarn'
- name: Install Yarn packages - name: Install Yarn packages
run: yarn install run: yarn install
@ -30,11 +30,27 @@ jobs:
# continue on error, so it still reports it in the next step # continue on error, so it still reports it in the next step
continue-on-error: true continue-on-error: true
- name: Annotate Code Linting Results - uses: actions/upload-artifact@v3
uses: ataylorme/eslint-annotate-action@v2
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" name: eslint_report.json
report-json: "eslint_report.json" path: eslint_report.json
building:
name: Build project
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install Yarn packages
run: yarn install
- name: Build Project - name: Build Project
run: npm run build run: yarn build

View File

@ -1,6 +1,10 @@
import { proxiedFetch } from "../helpers/fetch"; import { proxiedFetch } from "../helpers/fetch";
import { registerProvider } from "../helpers/register"; import { registerProvider } from "../helpers/register";
import { MWCaptionType, MWStreamQuality, MWStreamType } from "../helpers/streams"; import {
MWCaptionType,
MWStreamQuality,
MWStreamType,
} from "../helpers/streams";
import { MWMediaType } from "../metadata/types"; import { MWMediaType } from "../metadata/types";
const netfilmBase = "https://net-film.vercel.app"; const netfilmBase = "https://net-film.vercel.app";
@ -40,9 +44,12 @@ registerProvider({
// get stream info from media // get stream info from media
progress(75); progress(75);
const watchInfo = await proxiedFetch<any>(`/api/episode?id=${netfilmId}`, { const watchInfo = await proxiedFetch<any>(
baseURL: netfilmBase, `/api/episode?id=${netfilmId}`,
}); {
baseURL: netfilmBase,
}
);
const data = watchInfo.data; const data = watchInfo.data;
@ -56,12 +63,14 @@ registerProvider({
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""), url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
type: MWCaptionType.SRT, type: MWCaptionType.SRT,
langIso: sub.language, langIso: sub.language,
})) }));
return { return {
embeds: [], embeds: [],
stream: { stream: {
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"), streamUrl: source.url
.replace("akm-cdn", "aws-cdn")
.replace("gg-cdn", "aws-cdn"),
quality: qualityMap[source.quality as QualityInMap], quality: qualityMap[source.quality as QualityInMap],
type: MWStreamType.HLS, type: MWStreamType.HLS,
captions: mappedCaptions, captions: mappedCaptions,
@ -124,12 +133,14 @@ registerProvider({
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""), url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
type: MWCaptionType.SRT, type: MWCaptionType.SRT,
langIso: sub.language, langIso: sub.language,
})) }));
return { return {
embeds: [], embeds: [],
stream: { stream: {
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"), streamUrl: source.url
.replace("akm-cdn", "aws-cdn")
.replace("gg-cdn", "aws-cdn"),
quality: qualityMap[source.quality as QualityInMap], quality: qualityMap[source.quality as QualityInMap],
type: MWStreamType.HLS, type: MWStreamType.HLS,
captions: mappedCaptions, captions: mappedCaptions,