Skip to content

feat(raids): RSVP notification mode for raid and egg alarms (#233) #93

feat(raids): RSVP notification mode for raid and egg alarms (#233)

feat(raids): RSVP notification mode for raid and egg alarms (#233) #93

name: Build PR Preview Image
on:
pull_request:
types: [labeled, synchronize, reopened]
env:
REGISTRY: ghcr.io
IMAGE_NAME: pgan-dev/poracleweb.net
jobs:
preview:
# Only build when the 'preview' label is present. The label can be added
# at any time — subsequent pushes rebuild automatically via 'synchronize'.
if: contains(github.event.pull_request.labels.*.name, 'preview')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
pull-requests: write
steps:
- name: Checkout PR head
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=pr-${{ github.event.pull_request.number }}
type=sha,prefix=pr-${{ github.event.pull_request.number }}-
- name: Build and push
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Comment preview instructions on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: preview-image
message: |
## Preview image ready
Pull this PR's build and run it locally — see [TESTING.md](../blob/main/TESTING.md) for the full recipe.
```yaml
# docker-compose.yml
image: ghcr.io/pgan-dev/poracleweb.net:pr-${{ github.event.pull_request.number }}
```
```bash
docker compose pull && docker compose up -d --force-recreate
```
This tag rebuilds on every push to the PR. Report issues in this thread.
_Built from `${{ github.event.pull_request.head.sha }}` · [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})_