Skip to content

fix docs preview

fix docs preview #1

Workflow file for this run

name: PR Docs Preview (Pages)
on:
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz
python3 -m pip install --upgrade pip
python3 -m pip install mkdocs mkdocs-material pymdown-extensions
- name: Build docs (Makefile)
run: make clean document
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- id: deployment
uses: actions/deploy-pages@v4
with:
preview: true
- name: Add preview URL to summary
env:
PAGE_URL: ${{ steps.deployment.outputs.page_url }}
run: echo "Preview: $PAGE_URL" >> "$GITHUB_STEP_SUMMARY"

Check failure on line 52 in .github/workflows/pr-preview.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pr-preview.yml

Invalid workflow file

You have an error in your yaml syntax on line 52
- name: Comment preview URL on PR
uses: actions/github-script@v7
env:
PAGE_URL: ${{ steps.deployment.outputs.page_url }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pr_number = context.payload.pull_request.number;
const url = process.env.PAGE_URL;
const marker = '<!-- pages-preview-url -->';
const body = `${marker}\nPreview: ${url}`;
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: pr_number });
const prev = comments.find(c => (c.body || '').includes(marker));
if (prev) {
await github.rest.issues.updateComment({ owner, repo, comment_id: prev.id, body });
} else {
await github.rest.issues.createComment({ owner, repo, issue_number: pr_number, body });
}