Skip to content

Do not delete important directories not part of the website when syncing #731

Do not delete important directories not part of the website when syncing

Do not delete important directories not part of the website when syncing #731

name: Delete deployed PR from S3
on:
pull_request:
types: [closed]
branches: [main]
jobs:
delete_deployed_pr:
# Fix to ubuntu 22.04. In 2027, at the EOL of that distro, this GH warning will have to be addressed:
# The current runner (ubuntu-24.04-x64) was detected as self-hosted because the platform does not match a GitHub-hosted runner image (or that image is deprecated and no longer supported).
# In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build
# You can take inspiration from this workflow for more details: https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml
# $ ruby-build 3.1.4 /opt/hostedtoolcache/Ruby/3.1.4/x64
# Once that completes successfully, mark it as complete with:
# $ touch /opt/hostedtoolcache/Ruby/3.1.4/x64.complete
# It is your responsibility to ensure installing Ruby like that is not done in parallel.
runs-on: ubuntu-22.04
# PRs are only deployed if the PR branch is not in a fork
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- run: aws --endpoint-url https://s3.cern.ch s3 rm --recursive s3://root/${PR_NUMBER:?}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "eu-west-1"
PR_NUMBER: ${{ github.event.pull_request.number }}