From 7b8f9c765570a2c7ed5590fc3e0a381d9d7ee87c Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 9 Sep 2022 15:49:39 +0800 Subject: [PATCH] Fix checkout-pr by using fetch & checkout instead of pull --- docker/dockerfile | 5 +++-- extra/checkout-pr.js | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docker/dockerfile b/docker/dockerfile index fd947391e..eea6ba33d 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -44,8 +44,9 @@ RUN apt update \ RUN rm -rf ./* && chown node /app USER node - -RUN git clone --branch pr-test https://github.com/louislam/uptime-kuma.git . +RUN git config --global user.email "no-reply@no-reply.com" +RUN git config --global user.name "PR Tester" +RUN git clone https://github.com/louislam/uptime-kuma.git . RUN npm ci EXPOSE 3000 3001 diff --git a/extra/checkout-pr.js b/extra/checkout-pr.js index a68f05772..d327e2039 100644 --- a/extra/checkout-pr.js +++ b/extra/checkout-pr.js @@ -22,7 +22,12 @@ let result = childProcess.spawnSync("git", [ "remote", "add", name, `https://git console.log(result.stdout.toString()); console.error(result.stderr.toString()); -result = childProcess.spawnSync("git", [ "pull", name, branch ]); +result = childProcess.spawnSync("git", [ "fetch", name, branch ]); + +console.log(result.stdout.toString()); +console.error(result.stderr.toString()); + +result = childProcess.spawnSync("git", [ "checkout", branch, "--force" ]); console.log(result.stdout.toString()); console.error(result.stderr.toString());