Skip to content

Clean Docs for Deleted References #6

Clean Docs for Deleted References

Clean Docs for Deleted References #6

Workflow file for this run

name: Clean Docs for Deleted References
on:
delete:
jobs:
clean:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set github reference as docs_version_name environment variable
run: |
echo "docs_version_name=$(echo "${{ github.head_ref }}" | sed "s/\//\-/g")" >> "$GITHUB_ENV"
- name: If no github.head_ref, use last chunk of github.ref as docs_version_name
if: github.head_ref == ''
run: |
IFS="\/";
read -a strarr <<< "${{ github.ref }}";
last_ref="${strarr[${#strarr[*]}-1]}";
echo "docs_version_name=$(echo $last_ref)" >> "$GITHUB_ENV"
- name: Document which reference
run: |
echo "Deleting docs for reference: ${{ env.docs_version_name }}"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mike
- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Delete defunct docs versions
run: |
echo "Deleting ${{ env.docs_version_name }} version from docs"
mike delete --push ${{ env.docs_version_name }}