Skip to content

bypass name resolution (#477) #8

bypass name resolution (#477)

bypass name resolution (#477) #8

Workflow file for this run

---
name: "Sync Generated Docs"
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
env:
DOCS_REPO: "authzed/docs"
DOCS_BRANCH: "main"
GENERATED_DOCS_FILE: "docs/zed.md"
TARGET_DOCS_FILE: "pages/zed/zed.md"
CHANGES_DETECTED: false
permissions:
contents: "write"
pull-requests: "write"
actions: "write"
repository-projects: "write"
jobs:
sync-docs:
name: "Generate & Sync Documentation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "authzed/actions/setup-go@main"
- uses: "authzed/actions/setup-mage@main"
- name: "Generate Documentation"
run: "mage gen:docs"
- name: "Checkout docs repository"
uses: "actions/checkout@v4"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
repository: "${{ env.DOCS_REPO }}"
path: "docs-repo"
ref: "main"
- name: "Sync documentation changes"
run: |
mkdir -p docs-repo/$(dirname $TARGET_DOCS_FILE)
cp -v $GENERATED_DOCS_FILE docs-repo/$TARGET_DOCS_FILE
cd docs-repo
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add $TARGET_DOCS_FILE
if ! git diff --cached --exit-code; then
git commit -m "Update generated docs"
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
else
echo "No changes detected"
echo "CHANGES_DETECTED=false" >> $GITHUB_ENV
fi
- name: "Create pull request"
if: |
env.CHANGES_DETECTED == 'true'
uses: "peter-evans/create-pull-request@v7"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
path: "docs-repo"
title: "Auto-generated PR: Update zed docs"
body: "This PR was auto-generated by GitHub Actions."
branch: "auto-update-branch"