-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kartikay <[email protected]>
- Loading branch information
1 parent
41264b1
commit b2fb87b
Showing
1 changed file
with
20 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" |