Tucker McKnight <tmcknight@instructure.com> | Sun Jan 18 2026
Allow globs to be used instead of branch names The max value still doesn't do anything, but the glob string does. All branches matching a glob string will be added to the list of branches to be included in the site. This is also the list of branches that is used to determine which branches should be pulled when the eleventy.beforeConfig clones its copy of the repository.
0 1 2 3 4 5
import fsImport from 'fs'
import util from 'util'
import childProcess from 'child_process'
import repos from './src/repos.ts'
import branches from './src/branches.ts'
import flatFiles from './src/flatFiles.ts'
import flatPatches from './src/flatPatches.ts'0 1 2 3 4 5
import fsImport from 'fs'
import util from 'util'
import childProcess from 'child_process'
import {repos, getBranchNames} from './src/repos.ts'
import branches from './src/branches.ts'
import flatFiles from './src/flatFiles.ts'
import flatPatches from './src/flatPatches.ts'41 42 43 44 45 46
// git repos are just in the repos folder, not in their subdir
// create string of commands saying 'git fetch origin branch:branch' for each branch
const location = directories.output + reposPath + "/" + gitRepoName
const fetchCommands = repoConfig.branchesToPull.map(branch => `git -C ${location} fetch origin ${branch}:${branch}`).join('; ')
await exec(`${fetchCommands} && git -C ${location} update-server-info`)
} else {
// If it is not there, do git clone41 42 43 44 45 46
// git repos are just in the repos folder, not in their subdir
// create string of commands saying 'git fetch origin branch:branch' for each branch
const location = directories.output + reposPath + "/" + gitRepoName
const fetchCommands = (await getBranchNames(repoConfig, repoName)).map(branch => `git -C ${location} fetch origin ${branch}:${branch}`).join('; ')
await exec(`${fetchCommands} && git -C ${location} update-server-info`)
} else {
// If it is not there, do git clone109 110 111 112 113 114
const tempDirRepoPath = `${tempDir}/${eleventyConfig.getFilter("slugify")(repoName)}`
await exec(`mkdir ${tempDir}`)
await exec(`git clone -s ${directories.output}${eleventyConfig.getFilter("slugify")(repoName)}.git ${tempDirRepoPath}`)
for (let branch of repoConfig.branchesToPull) {
// TODO why doesn't git -C checkout work? Says that repo doesn't exist
await exec(`(cd ${tempDirRepoPath} && git checkout ${branch})`)
for (let buildStep of repoConfig.buildSteps) {109 110 111 112 113 114
const tempDirRepoPath = `${tempDir}/${eleventyConfig.getFilter("slugify")(repoName)}`
await exec(`mkdir ${tempDir}`)
await exec(`git clone -s ${directories.output}${eleventyConfig.getFilter("slugify")(repoName)}.git ${tempDirRepoPath}`)
for (let branch of await getBranchNames(repoConfig, repoName)) {
// TODO why doesn't git -C checkout work? Says that repo doesn't exist
await exec(`(cd ${tempDirRepoPath} && git checkout ${branch})`)
for (let buildStep of repoConfig.buildSteps) {32 33 34 35 36 37 38 39 40
cachedRepos = []
for (const repoName of repoNames) {
const branchNames = getBranchNames(reposConfig.repos[repoName])
const commits: Repository['commits'] = new Map()
for (const branchName of branchNames) {
const repoLocation = getLocation(reposConfig, outputDir, repoName)
await addBranchToCommitsMap(branchName, repoLocation, commits)
}
32 33 34 35 36 37 38 39 40
cachedRepos = []
for (const repoName of repoNames) {
const repoLocation = getLocation(reposConfig, outputDir, repoName)
const branchNames = await getBranchNames(reposConfig.repos[repoName], repoName)
const commits: Repository['commits'] = new Map()
for (const branchName of branchNames) {
await addBranchToCommitsMap(branchName, repoLocation, commits)
}
64 65 66
return cachedRepos
}
export default repos64 65 66
return cachedRepos
}
export {repos, getBranchNames}