From f428b14ee0bc48c55f57161be86df9a3f4a6e38e Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Tue, 3 Dec 2024 17:27:13 +0100 Subject: [PATCH] :recycle: Refactor the documentation workflow Always run the workflow, but only push to gh-pages on changes to main --- .github/workflows/documentation.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 17dde7b..aed67a1 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -2,8 +2,7 @@ name: Documentation on: push: - branches: - - main + pull_request: jobs: deploy: @@ -21,7 +20,7 @@ jobs: git remote set-url origin https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git - run: yarn install - run: yarn typedoc src/index.ts --out /tmp/docs - - name: deploy documentation + - name: commit documentation run: | git ls-remote --exit-code . origin/gh-pages \ && git checkout -b gh-pages \ @@ -31,5 +30,8 @@ jobs: cp --recursive /tmp/docs/. . echo /node_modules > .gitignore git add --all - git commit --all --message ":memo: docs: Update generated documentation" + git commit --all --message ":memo: docs: Update generated documentation" || echo "No changes to commit" + - name: push documentation + if: github.ref_name == 'main' + run: | git push origin gh-pages