From e447de936d4a0838f235e321cbb3dc3d50a9c3cf Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Sat, 28 Dec 2024 10:57:33 +0000 Subject: [PATCH] ci: only build docs on main branch pushes Don't build docs on pushes to maint branches; those docs should only be built _on release_. In addition, be safer about not creating an existing branch from a tracking branch. --- .github/workflows/documentation.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index da3effd8e..d82887d27 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,7 +3,7 @@ name: Generate Documentation on: push: - branches: [ main, maint/* ] + branches: [ main ] release: workflow_dispatch: inputs: @@ -37,12 +37,10 @@ jobs: ssh-key: ${{ secrets.DOCS_PUBLISH_KEY }} - name: Prepare branches run: | - if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then - git branch --track main origin/main - fi - - for a in $(git branch -r --list 'origin/maint/*' | sed -e "s/^ origin\///"); do - git branch --track "$a" "origin/$a" + for a in main $(git branch -r --list 'origin/maint/*' | sed -e "s/^ origin\///"); do + if [ "$(git rev-parse --abbrev-ref HEAD)" != "${a}" ]; then + git branch --track "$a" "origin/$a" + fi done working-directory: source - name: Generate documentation