mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
47 lines
1.7 KiB
YAML
47 lines
1.7 KiB
YAML
name: Preview label
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled, closed]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
comment-status:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'preview' }}
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
|
|
with:
|
|
message-id: 'preview-status'
|
|
message: 'Deploying preview environment to https://pr-${{ github.event.pull_request.number }}.preview.internal.immich.cloud/'
|
|
|
|
remove-label:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ (github.event.action == 'closed' || github.event.pull_request.head.repo.fork) && contains(github.event.pull_request.labels.*.name, 'preview') }}
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
script: |
|
|
github.rest.issues.removeLabel({
|
|
issue_number: context.payload.pull_request.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'preview'
|
|
})
|
|
|
|
- uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
|
|
if: ${{ github.event.pull_request.head.repo.fork }}
|
|
with:
|
|
message-id: 'preview-status'
|
|
message: 'PRs from forks cannot have preview environments.'
|
|
|
|
- uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
|
|
if: ${{ !github.event.pull_request.head.repo.fork }}
|
|
with:
|
|
message-id: 'preview-status'
|
|
message: 'Preview environment has been removed.'
|