Repository navigation
feat: integrate Flowise AI chatbot widget #289
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Broken Links | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'docs/**' | |
| - 'i18n/**' | |
| - 'src/**' | |
| - 'docusaurus.config.js' | |
| - 'sidebars.js' | |
| jobs: | |
| check-links: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| strategy: | |
| matrix: | |
| locale: [en, es, ja, ko] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Check broken links for ${{ matrix.locale }} | |
| id: check-links | |
| run: | | |
| echo "🔍 Checking broken links for locale: ${{ matrix.locale }}" | |
| # Run the check-links script for this locale | |
| set +e | |
| yarn check-links:${{ matrix.locale }} 2>&1 | tee build-output.txt | |
| BUILD_EXIT_CODE=${PIPESTATUS[0]} | |
| set -e | |
| # Parse broken links and anchors separately from output | |
| BROKEN_LINKS=$(grep -A1 "Broken link on source page path" build-output.txt | grep -E "(Broken link|-> linking to)" || true) | |
| BROKEN_ANCHORS=$(grep -A1 "Broken anchor on source page path" build-output.txt | grep -E "(Broken anchor|-> linking to)" || true) | |
| if [ $BUILD_EXIT_CODE -ne 0 ] && ([ -n "$BROKEN_LINKS" ] || [ -n "$BROKEN_ANCHORS" ]); then | |
| echo "has_broken=true" >> $GITHUB_OUTPUT | |
| echo "broken_links<<EOF" >> $GITHUB_OUTPUT | |
| echo "$BROKEN_LINKS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "broken_anchors<<EOF" >> $GITHUB_OUTPUT | |
| echo "$BROKEN_ANCHORS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_broken=false" >> $GITHUB_OUTPUT | |
| fi | |
| exit $BUILD_EXIT_CODE | |
| env: | |
| MENDABLE_KEY: ${{ secrets.MENDABLE_KEY }} | |
| COOKBOOK_PUBLIC_API_KEY: ${{ secrets.COOKBOOK_PUBLIC_API_KEY }} | |
| GTM_CONTAINER_ID: ${{ secrets.GTM_CONTAINER_ID }} | |
| - name: Create comment body | |
| if: failure() && steps.check-links.outputs.has_broken == 'true' | |
| run: | | |
| cat << 'ENDOFFILE' > broken-links-comment.md | |
| ## 🔗 Broken Links/Anchors Found in ${{ matrix.locale }} | |
| The build found broken internal links or anchors. | |
| <details> | |
| <summary>🔗 Broken Links</summary> | |
| ``` | |
| ${{ steps.check-links.outputs.broken_links }} | |
| ``` | |
| </details> | |
| <details> | |
| <summary>⚓ Broken Anchors</summary> | |
| ``` | |
| ${{ steps.check-links.outputs.broken_anchors }} | |
| ``` | |
| </details> | |
| --- | |
| **How to fix:** | |
| 1. Check if the linked page exists | |
| 2. Update the link to the correct URL | |
| 3. If the page was moved, update to the new location | |
| 4. If the page was deleted, remove the link | |
| 5. For anchors, verify the heading ID exists on the target page | |
| ENDOFFILE | |
| - name: Comment on PR | |
| if: failure() && steps.check-links.outputs.has_broken == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const comment = fs.readFileSync('broken-links-comment.md', 'utf8'); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: comment | |
| }); |