Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 20 additions & 34 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,36 @@ jobs:
- name: "Generate Documentation"
run: "mage gen:docs"

- name: "Clone docs repository"
run: |
git clone --depth 1 --branch $DOCS_BRANCH https://github.com/$DOCS_REPO.git docs-repo || {
echo "Failed to clone docs repository"
exit 1
}
- 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"
id: "sync"
run: |
rsync -r --delete $GENERATED_DOCS_FILE/ docs-repo/$TARGET_DOCS_FILE
mkdir -p docs-repo/$(dirname $TARGET_DOCS_FILE)
cp -v $GENERATED_DOCS_FILE docs-repo/$TARGET_DOCS_FILE
cd docs-repo
if ! git diff --exit-code; then
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
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: "Configure Git"
if: |
env.CHANGES_DETECTED == 'true'
run: |
cd docs-repo
git config user.name "GitHub Actions"
git config user.email "actions@github.com"

- name: "Commit and push changes"
if: |
env.CHANGES_DETECTED == 'true'
run: |
cd docs-repo
git add $TARGET_DOCS_FILE
git commit -m "Update generated docs"
git push origin $DOCS_BRANCH

- name: "Create pull request"
if: |
env.CHANGES_DETECTED == 'true'
uses: "peter-evans/create-pull-request@v5"
uses: "peter-evans/create-pull-request@v7"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
commit-message: "Update generated docs"
branch: "update-generated-docs"
title: "Sync generated docs"
body: |
Update zed documentation in directory `$TARGET_DOCS_FILE` with the latest version from the zed repository
base: "$DOCS_BRANCH"
path: "docs-repo"
title: "Auto-generated PR: Update zed docs"
body: "This PR was auto-generated by GitHub Actions."
branch: "auto-update-branch"
Loading