chore: ensure build is considered production to enable indexing #363
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Delete pull request preview | |
on: | |
# XXX: Use pull_request_target to delete previews of PRs from fork | |
# It grants write access using the GITHUB_TOKEN, but it is safe as: | |
# - No code from the PR is built or executed | |
# - The worklfow file in use is the one from the base branch (main) | |
pull_request_target: | |
# Run for PR against main when label is removed or pull request closed | |
types: | |
- unlabeled | |
- closed | |
branches: | |
- main | |
permissions: read-all | |
jobs: | |
delete_preview: | |
# XXX: Do not run at forks, and only if "safe for preview" label is set | |
if: > | |
github.repository == 'EGI-Federation/documentation' && | |
((github.event.action == 'unlabeled' && github.event.label.name == 'safe | |
for preview') || (github.event.action == 'closed' && | |
contains(github.event.pull_request.labels.*.name, 'safe for preview'))) | |
name: Delete PR preview when a PR is closed or label removed | |
# Ensure GITHUB_TOKEN can be usd to write to the repository content | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "pr_previews" | |
- name: Delete pull request preview and commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
remove: "-r ${{ github.event.number }}/" | |
message: "Purge preview for PR ${{ github.event.number }}" |