// Find the GitHub branch we are running from
getBranch = function (path, repository) {
    // The branch is the word after the repository name, and before the word "tests"
    // Assumes that the branch exists in the path
    
    // Note that the repository includes a final '/'
    var repositoryName = repository.slice(0,-1);
    
    var words = path.split("/");
    for (var i = 0; i < words.length - 2; ++i) {
        if (words[i] === repositoryName && words[i + 2] === "tests") {
            return words[i + 1];
        }
    }
    
    return "branch not found";
}

@@ -216,21 +216,17 @@
 he path%0A
-    
 %0A
+
     // N
@@ -319,21 +319,17 @@
 (0,-1);%0A
-    
 %0A
+
     var 
@@ -353,16 +353,235 @@
 t(%22/%22);%0A
+%0A    // If the first word is not %22https%22 then the script is probably running from a local file%0A    // In this case, assume the required branch is %22master%22%0A    if (words%5B0%5D !== %22htpps%22) %7B%0A        return %22master%22;%0A    %7D%0A%0A
     for 
@@ -741,20 +741,48 @@
 %7D%0A    %7D%0A
+%0A
     
+// This should never happen
 %0A    ret

Deal with call from local script.