-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (43 loc) · 1.55 KB
/
development_cleanup.yml
File metadata and controls
43 lines (43 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
# =============================================================================
# development_cleanup.yml
#
# Triggers:
# pull_request → closed (merged or abandoned)
#
# Purpose:
# Deletes the ephemeral documentation preview deployed to GitHub Pages
# during the PR lifecycle (e.g., pr-123/) to prevent gh-pages branch bloat.
# =============================================================================
name: "CI — Development Cleanup"
on:
pull_request:
types:
- closed
permissions:
contents: write # Required to push deletion to gh-pages
jobs:
cleanup-pr-docs:
name: "Delete PR Docs Preview"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.x"
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Install Mike
run: pip install mike
- name: Delete PR docs preview
run: |-
PR_PATH="pr-${{ github.event.pull_request.number }}"
echo "Deleting docs preview at path: ${PR_PATH}"
# Delete the versioned path from gh-pages; ignore errors if it doesn't exist
mike delete --push "${PR_PATH}" || echo "No docs preview found for ${PR_PATH}, nothing to clean up."