]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use current git branch by default when setting up cypress container 36221/head
authorLouis Chemineau <louis@chmn.me>
Wed, 18 Jan 2023 16:00:24 +0000 (17:00 +0100)
committerLouis Chemineau <louis@chmn.me>
Wed, 18 Jan 2023 16:17:06 +0000 (17:17 +0100)
Signed-off-by: Louis Chemineau <louis@chmn.me>
cypress/dockerNode.ts

index c9f53d50bf08a6bac2e031813be0328443721820..ae3948877b97d36bf889874af91f64ea2cdfaad8 100644 (file)
@@ -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<any> {
+export const startNextcloud = async function(branch: string = getCurrentGitBranch()): Promise<any> {
 
        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'
+}