Skip to content

Commit

Permalink
fixed workflow (#466)
Browse files Browse the repository at this point in the history
Signed-off-by: Kartikay <[email protected]>
  • Loading branch information
kartikaysaxena authored Feb 10, 2025
1 parent 41264b1 commit b2fb87b
Showing 1 changed file with 20 additions and 34 deletions.
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 "[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: "Configure Git"
if: |
env.CHANGES_DETECTED == 'true'
run: |
cd docs-repo
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- 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"

0 comments on commit b2fb87b

Please sign in to comment.