From 9e3ff04a27867c18d3df752e953b23c809c5b9d9 Mon Sep 17 00:00:00 2001 From: Pete Cheslock Date: Thu, 7 Aug 2025 12:00:54 -0400 Subject: [PATCH 1/2] Add link verification workflow for pull requests This commit introduces a new GitHub Actions workflow that verifies links in the application during pull requests. The workflow includes steps for checking out the repository, setting up Node.js and Python, installing dependencies, building the application, and running a link verification script against the application running locally. Signed-off-by: Pete Cheslock --- .github/workflows/link-verification.yml | 79 +++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/link-verification.yml diff --git a/.github/workflows/link-verification.yml b/.github/workflows/link-verification.yml new file mode 100644 index 0000000..e50e3ae --- /dev/null +++ b/.github/workflows/link-verification.yml @@ -0,0 +1,79 @@ +name: Link Verification on Pull Request + +on: + pull_request: + branches: [ main, master ] + types: [opened, synchronize, reopened] + +jobs: + link-verification: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build the application + run: npm run build + + - name: Setup Python for link verifier + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Download and setup link verifier + run: | + curl -o requirements.txt https://raw.githubusercontent.com/jjasghar/link-verifier-llm-d.ai/9930050b977f00f78dbe8d361814f359115df492/requirements.txt + curl -o link_verifier.py https://raw.githubusercontent.com/jjasghar/link-verifier-llm-d.ai/9930050b977f00f78dbe8d361814f359115df492/link_verifier.py + pip install -r requirements.txt + + - name: Start the application in background + run: | + npm run start & + echo $! > server.pid + + - name: Wait for application to be ready + run: | + echo "Waiting for application to start on port 3000..." + timeout=60 + counter=0 + + while [ $counter -lt $timeout ]; do + if curl -f http://localhost:3000 >/dev/null 2>&1; then + echo "✅ Application is ready!" + break + fi + + echo "⏳ Waiting... ($counter/$timeout seconds)" + sleep 1 + counter=$((counter + 1)) + done + + if [ $counter -eq $timeout ]; then + echo "❌ Application failed to start within $timeout seconds" + exit 1 + fi + + - name: Run link verification + run: python link_verifier.py --url http://localhost:3000 + + - name: Cleanup + if: always() + run: | + if [ -f server.pid ]; then + kill $(cat server.pid) 2>/dev/null || true + rm -f server.pid + fi + # Kill any remaining node processes + pkill -f "docusaurus start" || true \ No newline at end of file From 57622aafc55dd5c2c1e9be5e3653917edbe5b886 Mon Sep 17 00:00:00 2001 From: Pete Cheslock Date: Thu, 7 Aug 2025 12:13:59 -0400 Subject: [PATCH 2/2] Need to serve the built site Signed-off-by: Pete Cheslock --- .github/workflows/link-verification.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/link-verification.yml b/.github/workflows/link-verification.yml index e50e3ae..e66a26f 100644 --- a/.github/workflows/link-verification.yml +++ b/.github/workflows/link-verification.yml @@ -40,7 +40,7 @@ jobs: - name: Start the application in background run: | - npm run start & + npm run serve & echo $! > server.pid - name: Wait for application to be ready