Skip to content

Clean Docs for Deleted References #64

Clean Docs for Deleted References

Clean Docs for Deleted References #64

Workflow file for this run

name: Clean Docs for Deleted References
on:
delete:
jobs:
clean:
if: github.repository_owner == 'TIDES-transit'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set github reference as Slug environment variable
run: |
echo "Slug=$(echo "${{ github.head_ref }}" | sed "s/\//\-/g")" >> "$GITHUB_ENV"
- name: If no github.head_ref, use last chunk of github.ref as Slug
if: github.head_ref == ''
run: |
IFS="\/";
read -a strarr <<< "${{ github.event.ref }}";
last_ref="${strarr[${#strarr[*]}-1]}";
echo "Slug=$(echo $last_ref)" >> "$GITHUB_ENV"
- name: Document which reference
run: echo "Running for reference ${{ env.Slug }}"
- name: Set up Python $PYTHON_VERSION
uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- 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.Slug }} version from docs"
mike delete --rebase --push ${{ env.Slug }}