You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by he...@apache.org on 2023/05/03 15:41:44 UTC

[incubator-devlake-website] branch main updated: ci(link): link check support change of doc sturcture (#510)

This is an automated email from the ASF dual-hosted git repository.

hez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake-website.git


The following commit(s) were added to refs/heads/main by this push:
     new b739de6bd6 ci(link): link check support change of doc sturcture (#510)
b739de6bd6 is described below

commit b739de6bd669a1af2bd47c272931d397e257e637
Author: Bird <af...@gmail.com>
AuthorDate: Wed May 3 23:41:39 2023 +0800

    ci(link): link check support change of doc sturcture (#510)
    
    Signed-off-by: Bird <af...@gmail.com>
---
 .github/workflows/pr_ci.yaml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml
index 5d503fe478..7d3ed22073 100644
--- a/.github/workflows/pr_ci.yaml
+++ b/.github/workflows/pr_ci.yaml
@@ -15,10 +15,22 @@ jobs:
         uses: actions/setup-node@main
         with:
           node-version: 17.8.x
+      - name: Replace base url
+        run: |
+          # replace base url to localhost to support change of doc structure
+          sed -i 's#https://devlake.apache.org#http://local.devlake.apache.org#g' docusaurus.config.js
+      - name: Edit hosts
+        run: |
+          # why we need this:
+          # lychee will ignore links to localhost, so we need to add a new domain to avoid this
+          echo "127.0.0.1 local.devlake.apache.org" | sudo tee -a /etc/hosts
       - name: Build Docusaurus website
         run: |
           npm install
           npm run build
+      - name: Install http-server
+        run: |
+          sudo npm install -g http-server
       - name: Install lychee
         env:
           LYCHEEVERSION: 0.12.0
@@ -35,6 +47,12 @@ jobs:
         env:
           GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
         run: |
+          # to run a local server, so that lychee can check links on it rather than on devlake.apache.org
+          sudo http-server ./build -s -p 80 -a 0.0.0.0 &
+          # wait for http-server to start
+          npm install wait-on
+          npx wait-on http://local.devlake.apache.org -t 60000
+          
           # For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters
           # -E, --exclude-all-private    Exclude all private IPs from checking.
           # -i, --insecure               Proceed for server connections considered insecure (invalid TLS)