Skip to content

Docs Cleanup CI

Docs Cleanup CI #20

Workflow file for this run

name: Docs Cleanup CI
# delete branch documentation when a branch is deleted
# also allow manually deleting a documentation version
on:
delete:
workflow_dispatch:
inputs:
version:
description: "documentation version to DELETE"
required: true
type: string
jobs:
remove:
if: github.event.ref_type == 'branch' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: gh-pages
- name: removing documentation for branch ${{ github.event.ref }}
if: ${{ github.event_name != 'workflow_dispatch' }}
run: echo "remove_me=${{ github.event.ref }}" >> $GITHUB_ENV
- name: manually removing documentation version ${{ github.event.inputs.version }}
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "remove_me=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: update index and push changes
run: |
echo removing redundant documentation version ${{ env.remove_me }}
rm -r ${{ env.remove_me }}
sed -i /${{ env.remove_me }}/d versions.txt
git config --global user.name 'GitHub Actions Docs Cleanup CI'
git config --global user.email '[email protected]'
git commit -am"removing redundant docs version ${{ env.remove_me }}"
git push