From bdd5f4b07840d01bec1c0386fab0096b2da5970f Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 9 Mar 2026 22:59:31 -0400 Subject: [PATCH] add PR label to trigger preview build --- .github/workflows/test-build.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 089585b82..0904d9569 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,6 +1,8 @@ name: Build Experimental Docker Image on: + pull_request: + types: [labeled] workflow_dispatch: inputs: # trunk-ignore(checkov/CKV_GHA_7) @@ -13,9 +15,13 @@ permissions: contents: write packages: write actions: write + pull-requests: write jobs: build: + if: | + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'build-preview') runs-on: ubuntu-latest permissions: id-token: write @@ -28,7 +34,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4.3.0 with: - ref: ${{ github.event.inputs.branch }} + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }} fetch-depth: 0 - name: Set up QEMU @@ -50,7 +56,7 @@ jobs: images: | name=rommapp/romm-testing tags: | - type=raw,value=${{ github.event.inputs.branch }} + type=raw,value=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }} - name: Build full image id: build-full @@ -62,3 +68,15 @@ jobs: platforms: linux/arm64,linux/amd64 tags: ${{ steps.meta.outputs.tags }} target: full-image + + - name: Comment PR with Docker image link + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `✅ Docker image built successfully!\n\nDocker image: \`rommapp/romm-testing:${{ github.head_ref }}\`` + })