Skip to content

Commit

Permalink
chore: fix route test github actions (#14923)
Browse files Browse the repository at this point in the history
* chore: fix route test actions

* chore: bump unified
  • Loading branch information
TonyRL committed Mar 23, 2024
1 parent 7cd8f9c commit 847fdab
Show file tree
Hide file tree
Showing 11 changed files with 664 additions and 531 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ updates:
ignore:
- dependency-name: jsrsasign
versions: ['>=11.0.0'] # no longer includes KJUR.crypto.Cipher for RSA
- dependency-name: unified
versions: ['>=10.0.0']

- package-ecosystem: 'github-actions'
directory: '/'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/comment-on-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v4 # just need its cache
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
- name: Install dependencies (pnpm) # needed since we need to parse markdown, so we also use got instead
- name: Install dependencies (pnpm) # import remark-parse and unified
run: pnpm i
- name: Generate feedback
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-issue/call-maintainer.js`)
return script({ github, context, core })
const { default: callMaintainer } = await import('${{ github.workspace }}/scripts/workflow/test-issue/call-maintainer.mjs')
await callMaintainer({ github, context, core })
21 changes: 10 additions & 11 deletions .github/workflows/docker-test-cont.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: PR - route test

on:
workflow_run:
workflows: [ PR - Docker build test ] # open, reopen, synchronized, edited included
types: [ completed ]
workflows: [PR - Docker build test] # open, reopen, synchronized, edited included
types: [completed]

jobs:
testRoute:
name: Route test
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }} # skip if unsuccessful
if: ${{ github.event.workflow_run.conclusion == 'success' }} # skip if unsuccessful
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -44,8 +44,8 @@ jobs:
const body = PR.body
const number = PR.number
const sender = PR.user.login
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/identify.js`)
return script({ github, context, core }, body, number, sender)
const { default: identify } = await import('${{ github.workspace }}/scripts/workflow/test-route/identify.mjs')
return identify({ github, context, core }, body, number, sender)
- name: Fetch Docker image
if: (env.TEST_CONTINUE)
Expand All @@ -72,13 +72,13 @@ jobs:
with:
version: 8

- uses: actions/setup-node@v4 # just need its cache
- uses: actions/setup-node@v4
if: (env.TEST_CONTINUE)
with:
node-version: lts/*
cache: 'pnpm'

- name: Install dependencies (pnpm) # `got` needed since `github.request` disallows HTTP requests
- name: Install dependencies (pnpm) # require js-beautify
if: (env.TEST_CONTINUE)
run: pnpm i

Expand All @@ -99,9 +99,8 @@ jobs:
const routes = JSON.parse(process.env.TEST_ROUTES)
const number = PR.number
core.info(`${link}, ${routes}, ${number}`)
const got = require("got")
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/test.js`)
return script({ github, context, core, got }, link, routes, number)
const { default: test } = await import('${{ github.workspace }}/scripts/workflow/test-route/test.mjs')
await test({ github, context, core }, link, routes, number)
- name: Pull Request Labeler
if: ${{ failure() }}
Expand All @@ -114,4 +113,4 @@ jobs:

- name: Print Docker container logs
if: (env.TEST_CONTINUE)
run: docker logs rsshub # logs/combined.log? Not so readable...
run: docker logs rsshub # logs/combined.log? Not so readable...
9 changes: 4 additions & 5 deletions .github/workflows/issue-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
const body = event.comment.body
const number = event.issue.number
const sender = event.comment.user.login
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/identify.js`)
return script({ github, context, core }, body, number, sender)
const { default: identify } = await import('${{ github.workspace }}/scripts/workflow/test-route/identify.mjs')
return identify({ github, context, core }, body, number, sender)
- name: Build RSSHub
if: env.TEST_CONTINUE
Expand Down Expand Up @@ -107,9 +107,8 @@ jobs:
const routes = JSON.parse(process.env.TEST_ROUTES)
const number = event.issue.number
core.info(`${link}, ${routes}, ${number}`)
const got = require("got")
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/test.js`)
return script({ github, context, core, got }, link, routes, number)
const { default: test } = await import('${{ github.workspace }}/scripts/workflow/test-route/test.mjs')
await test({ github, context, core }, link, routes, number)
- name: Print logs
if: (env.TEST_CONTINUE)
Expand Down
13 changes: 6 additions & 7 deletions lib/views/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ const Index: FC<{
<div className="text-left w-[800px] space-y-6 !mt-10">
<div className="space-y-2">
<p className="mb-2 font-bold">Helpful Information</p>
<p>Error Message:</p>
<code className="mt-2 block max-h-28 overflow-auto bg-zinc-100 align-bottom w-fit details">{message}</code>
<p>Route: <code className="ml-2 bg-zinc-100">{errorRoute}</code></p>
<p>Full Route: <code className="ml-2 bg-zinc-100">{requestPath}</code></p>
<p>Node Version: <code className="ml-2 bg-zinc-100">{nodeVersion}</code></p>
<p>Git Hash: <code className="ml-2 bg-zinc-100">{gitHash}</code></p>
<p>Git Date: <code className="ml-2 bg-zinc-100">{gitDate?.toUTCString()}</code></p>
<p className="message">Error Message:<br/><code className="mt-2 block max-h-28 overflow-auto bg-zinc-100 align-bottom w-fit details">{message}</code></p>
<p className="message">Route: <code className="ml-2 bg-zinc-100">{errorRoute}</code></p>
<p className="message">Full Route: <code className="ml-2 bg-zinc-100">{requestPath}</code></p>
<p className="message">Node Version: <code className="ml-2 bg-zinc-100">{nodeVersion}</code></p>
<p className="message">Git Hash: <code className="ml-2 bg-zinc-100">{gitHash}</code></p>
<p className="message">Git Date: <code className="ml-2 bg-zinc-100">{gitDate?.toUTCString()}</code></p>
</div>
<div>
<p className="mb-2 font-bold">Report</p>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"eslint-plugin-yml": "1.13.2",
"fs-extra": "11.2.0",
"husky": "9.0.11",
"js-beautify": "1.15.1",
"lint-staged": "15.2.2",
"mockdate": "3.0.5",
"nock": "13.5.4",
Expand All @@ -165,7 +166,7 @@
"supertest": "6.3.4",
"tosource": "2.0.0-alpha.3",
"typescript": "5.4.3",
"unified": "9.2.2",
"unified": "11.0.4",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.4.0"
},
Expand Down

0 comments on commit 847fdab

Please sign in to comment.