From 95e1bfeda4f66d713db52fc0599b295e4f69a6f5 Mon Sep 17 00:00:00 2001 From: richardreeve Date: Wed, 26 Apr 2023 23:37:21 +0100 Subject: [PATCH] Update docs workflows --- .github/workflows/doc-cleanup.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/docs.yaml | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/doc-cleanup.yaml diff --git a/.github/workflows/doc-cleanup.yaml b/.github/workflows/doc-cleanup.yaml new file mode 100644 index 00000000..5945be87 --- /dev/null +++ b/.github/workflows/doc-cleanup.yaml @@ -0,0 +1,26 @@ +name: Doc Preview Cleanup + +on: + pull_request: + types: [closed] + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v2 + with: + ref: gh-pages + - name: Delete preview and history + push changes + run: | + if [ -d "previews/PR$PRNUM" ]; then + git config user.name "richardreeve" + git config user.email "git@richardreeve.net" + git rm -rf "previews/PR$PRNUM" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + git push --force origin gh-pages-new:gh-pages + fi + env: + PRNUM: ${{ github.event.number }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 07054295..2fd032ef 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -6,10 +6,13 @@ on: - dev tags: - 'v*' + pull_request: workflow_dispatch: jobs: build: + permissions: + contents: write runs-on: ubuntu-latest steps: - name: Checkout code