Skip to content

Texture and mtl support #24

Texture and mtl support

Texture and mtl support #24

name: Docs Sync Check
# Warn when significant source code changes land without any documentation update.
# Runs on pull requests AND direct pushes to main.
on:
pull_request:
paths:
- "src/**"
- "resources/scenes/**"
- "CMakeLists.txt"
push:
branches:
- main
paths:
- "src/**"
- "resources/scenes/**"
permissions:
contents: read
pull-requests: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if docs were updated alongside source
id: check
run: |
# On a PR compare against the base; on a push compare against the previous commit
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
else
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
fi
# Skip if this is the very first commit (no before)
if [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
echo "First commit — skipping docs check."
echo "needs_docs=false" >> "$GITHUB_OUTPUT"
exit 0
fi
CHANGED=$(git diff --name-only "$BASE" "$HEAD" 2>/dev/null || true)
SRC_CHANGED=$(echo "$CHANGED" | grep -E '^(src/|resources/scenes/|CMakeLists\.txt)' | wc -l)
DOC_CHANGED=$(echo "$CHANGED" | grep -E '^website/' | wc -l)
echo "Source files changed: $SRC_CHANGED"
echo "Doc files changed: $DOC_CHANGED"
if [ "$SRC_CHANGED" -gt 0 ] && [ "$DOC_CHANGED" -eq 0 ]; then
echo "needs_docs=true" >> "$GITHUB_OUTPUT"
echo "src_count=$SRC_CHANGED" >> "$GITHUB_OUTPUT"
else
echo "needs_docs=false" >> "$GITHUB_OUTPUT"
fi
- name: Comment on PR if docs not updated
if: steps.check.outputs.needs_docs == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Docs out of sync?\n\n` +
`This PR changes **${{ steps.check.outputs.src_count }} source file(s)** but no pages under \`website/docs/\` were updated.\n\n` +
`If this is a significant change (new feature, new CLI flag, new material/geometry type, performance improvement), ` +
`please update the relevant documentation page. See the mapping in \`.github/copilot-instructions.md\`.\n\n` +
`_If this change genuinely doesn't affect the docs, you can ignore this message._`
})
- name: Fail with annotation on push to main
if: steps.check.outputs.needs_docs == 'true' && github.event_name == 'push'
run: |
echo "::warning::${{ steps.check.outputs.src_count }} source file(s) changed on main without any website/docs update. Consider updating the documentation."