From: Louis Chemineau Date: Wed, 18 Jan 2023 16:00:24 +0000 (+0100) Subject: Use current git branch by default when setting up cypress container X-Git-Tag: v26.0.0beta1~52^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=535c228d57cbd44bdde0621411074de52c934881;p=nextcloud-server.git Use current git branch by default when setting up cypress container Signed-off-by: Louis Chemineau --- diff --git a/cypress/dockerNode.ts b/cypress/dockerNode.ts index c9f53d50bf0..ae3948877b9 100644 --- a/cypress/dockerNode.ts +++ b/cypress/dockerNode.ts @@ -26,6 +26,7 @@ import Docker from 'dockerode' import waitOn from 'wait-on' import tar from 'tar' +import { execSync } from 'child_process' export const docker = new Docker() @@ -37,7 +38,7 @@ const SERVER_IMAGE = 'ghcr.io/nextcloud/continuous-integration-shallow-server' * * @param {string} branch the branch of your current work */ -export const startNextcloud = async function(branch = 'master'): Promise { +export const startNextcloud = async function(branch: string = getCurrentGitBranch()): Promise { try { // Pulling images @@ -245,3 +246,7 @@ const runExec = async function( const sleep = function(milliseconds: number) { return new Promise((resolve) => setTimeout(resolve, milliseconds)) } + +const getCurrentGitBranch = function() { + return execSync('git rev-parse --abbrev-ref HEAD').toString().trim() || 'master' +}