when:
  - event: pull_request_closed

steps:
  create-empty-dir:
    image: alpine
    commands:
      - mkdir _empty

  delete-preview:
    image: codeberg.org/gedankenstuecke/git-pages-woodpecker-plugin@sha256:5257561a95054104f7499838817f3b447049a1edc14e87b99156b1302e0bce36
    settings:
      SITE_URL: https://codeberg.codeberg.page/documentation
      PATH: pull_${CI_COMMIT_PULL_REQUEST}
      TOKEN:
        from_secret: surge_forge_token
      UPLOAD_DIR: _empty
    depends_on: create-empty-dir

  comment:
    image: mcs94/gitea-comment@sha256:f1a06366bfa34ff7594f369ebf81cbadd2d4410b7d51c9aa59c0c0264aa5fbd9
    settings:
      gitea_address: https://codeberg.org
      gitea_token:
        from_secret: surge_forge_token
      comment: 'Preview deleted.'
    depends_on: delete-preview
