Skip to content

[codex] Allow leg splitting in edit modes #219

[codex] Allow leg splitting in edit modes

[codex] Allow leg splitting in edit modes #219

name: Cleanup PR Deployments
# Marks every `pr-preview-<NUM>` deployment for a closed PR as inactive so the
# GitHub Deployments tab doesn't accumulate stale `success` entries from
# merged or abandoned previews. The deployment URLs themselves still resolve
# (Pages keeps the static files under /pr/<NUM>/), but the View deployment
# button on closed PRs no longer suggests they are live.
on:
pull_request:
types: [closed]
permissions:
contents: read
deployments: write
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Mark PR deployments inactive
env:
GH_TOKEN: ${{ github.token }}
ENV_NAME: pr-preview-${{ github.event.number }}
run: |
set -e
IDS=$(gh api "repos/${{ github.repository }}/deployments?environment=${ENV_NAME}" --jq '.[].id')
if [ -z "$IDS" ]; then
echo "No deployments found for environment ${ENV_NAME} — nothing to clean up."
exit 0
fi
for ID in $IDS; do
echo "Marking deployment $ID inactive (env=${ENV_NAME})"
gh api "repos/${{ github.repository }}/deployments/$ID/statuses" \
--input - <<EOF
{
"state": "inactive",
"description": "PR closed"
}
EOF
done