Files
egui/.github/workflows/preview_cleanup.yml
Dylan M. Taylor 0965b68bdc ci: lock workflow actions through an actions.lock lockfile
Mutable action tags are a supply-chain risk: a moved tag runs different code
without a diff. Every workflow action is now pinned through
.github/workflows/actions.lock, and CI verifies the lockfile so an out-of-sync
or tampered one fails instead of running.
2026-11-12 10:04:46 -05:00

42 lines
1.2 KiB
YAML

name: Preview Cleanup
permissions:
contents: write
on:
pull_request_target:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden runner
uses: step-security/harden-runner@v2.22.4
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@v4.4.0
- run: mkdir -p empty_dir
- name: Generate URL_SLUG
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
URL_SLUG: ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
run: |
# Sanitize the URL_SLUG to only contain alphanumeric characters and dashes
URL_SLUG=$(echo $URL_SLUG | tr -cd '[:alnum:]-')
echo "URL_SLUG=$URL_SLUG" >> $GITHUB_ENV
- name: Deploy
uses: step-security/github-pages-deploy-action@v4.9.0
with:
folder: empty_dir
repository-name: egui-pr-preview/pr
branch: 'main'
clean: true
target-folder: ${{ env.URL_SLUG }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
commit-message: "Remove preview for PR ${{ env.URL_SLUG }}"
single-commit: true