Skip to content

Commit b143475

Browse files
committed
fix(ci): deploy pages via pull request with auto-merge
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 4192c84 commit b143475

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,25 @@ jobs:
248248
mkdir -p server/${{ steps.branch.outputs.branch_name }}/user_manual
249249
mv user_manual/index.html server/${{ steps.branch.outputs.branch_name }}/user_manual/index.html
250250
251-
- name: Commit ${{ steps.branch.outputs.branch_name }} documentation and push to gh-pages
252-
run: |
253-
git config --local user.email "nextcloud-command@users.noreply.github.com"
254-
git config --local user.name "nextcloud-command"
255-
git add .
256-
git diff --staged --quiet || git commit -m "chore: deploy documentation for ${{ steps.branch.outputs.branch_name }}"
257-
# Ensure we are up to date with the remote gh-pages branch
258-
git pull --rebase origin gh-pages || true
259-
git push origin gh-pages || echo "Nothing to push (expected if no changes)"
251+
- name: Create Pull Request for documentation deployment
252+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
253+
id: cpr
254+
with:
255+
token: ${{ secrets.COMMAND_BOT_PAT }}
256+
commit-message: "chore: deploy documentation for ${{ steps.branch.outputs.branch_name }}"
257+
committer: nextcloud-command <nextcloud-command@users.noreply.github.com>
258+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
259+
signoff: true
260+
branch: "automated/deploy/documentation-${{ steps.branch.outputs.branch_name }}"
261+
base: gh-pages
262+
title: "Deploy documentation for ${{ steps.branch.outputs.branch_name }}"
263+
body: "Automated documentation deployment from branch ${{ github.ref_name }}"
264+
delete-branch: true
265+
labels: "automated, 3. to review"
266+
267+
- name: Enable Pull Request Automerge
268+
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}"
269+
if: steps.cpr.outputs.pull-request-number != ''
260270
env:
261271
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
262272

0 commit comments

Comments
 (0)