From 9eb7a3a751f958a3913053d17730f3668d36eef7 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 25 Jun 2026 18:28:04 +0800 Subject: [PATCH] chore: add build "pr-test" workflow, add a message for testing to new pr. (#7543) --- .github/workflows/build-docker-pr-test.yml | 42 ++++++++++++++++++++++ .github/workflows/pr-description-check.yml | 10 ++++-- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build-docker-pr-test.yml diff --git a/.github/workflows/build-docker-pr-test.yml b/.github/workflows/build-docker-pr-test.yml new file mode 100644 index 000000000..b68ad7375 --- /dev/null +++ b/.github/workflows/build-docker-pr-test.yml @@ -0,0 +1,42 @@ +name: Build PR Test Docker Image + +on: + schedule: + # Runs at 2:00 AM UTC on the 1st of every month + - cron: "0 2 1 * *" + workflow_dispatch: # Allow manual trigger + +permissions: {} + +jobs: + build-docker-pr-test: + # Only run on the original repository, not on forks + if: github.repository == 'louislam/uptime-kuma' + runs-on: ubuntu-latest + timeout-minutes: 120 + permissions: + contents: read + + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: { persist-credentials: false } + + - name: Set up QEMU + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 + + - name: Login to Docker Hub + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Use Node.js 26 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 26 + + - name: Build and push pr-test2 + run: node --run build-docker-pr-test diff --git a/.github/workflows/pr-description-check.yml b/.github/workflows/pr-description-check.yml index 49974859d..cde0d11c5 100644 --- a/.github/workflows/pr-description-check.yml +++ b/.github/workflows/pr-description-check.yml @@ -36,10 +36,11 @@ jobs: return; } + const owner = context.repo.owner; + const repo = context.repo.repo; + const number = pr.number; + if (!body || !body.toLowerCase().includes(requiredPhrase.toLowerCase())) { - const owner = context.repo.owner; - const repo = context.repo.repo; - const number = pr.number; const commentBody = `Hello! This pull request does not follow the repository's PR template and is being closed automatically.`; @@ -52,4 +53,7 @@ jobs: core.info(`Closed PR #${number} because required phrase was not present.`); } else { core.info("PR description contains required phrase; no action taken."); + + const commentBody = `Thanks for the PR! If anyone would like to help with testing, run: \`npx kuma-pr ${pr.user.login}:${pr.head.ref}\` (requires Node.js and Docker)`; + await github.rest.issues.createComment({ owner, repo, issue_number: number, body: commentBody }); }