-
-
Notifications
You must be signed in to change notification settings - Fork 81
50 lines (43 loc) · 1.68 KB
/
pr_cleaner_post_merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: "🧹 PR Cleaner"
# See: https://shipit.dev/posts/trigger-github-actions-on-pr-close.html
# only trigger on pull request closed events, that includes both merged and closed (dismissed) PRs
on:
pull_request_target:
types: [closed]
# Environment variables
env:
BUILD_DIR: build/
NETLIFY_SITE_NAME: geotribu-preprod
NETLIFY_SITE_PREFIX: preview-pullrequest-${{ github.event.pull_request.number }}
jobs:
clean-preview:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'geotribu' }}
steps:
- name: Get source code
uses: actions/checkout@v4
- name: Prepare redirection
run: |
mkdir -p ${{ env.BUILD_DIR }}
cp scripts/redirect.html ${{ env.BUILD_DIR }}/index.html
cp scripts/redirect.html ${{ env.BUILD_DIR }}/404.html
- name: Deploy preview to Netlify
uses: nwtgck/[email protected]
id: preview
timeout-minutes: 1
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
alias: ${{ env.NETLIFY_SITE_PREFIX }}
deploy-message: "Clean preview of PR ${{ github.event.pull_request.title }} (PR #${{ env.PR_NUMBER }}"
enable-commit-comment: false
enable-commit-status: false
enable-pull-request-comment: false
fails-without-credentials: true
github-deployment-environment: pr-previews
github-deployment-description: "Preview deploy for PRs"
github-token: ${{ secrets.GITHUB_TOKEN }}
overwrites-pull-request-comment: false
production-deploy: false
publish-dir: ${{ env.BUILD_DIR }}