Add "automatic workspace discovery" to `transformChanges`
Created by: mrnugget
(Just replicating what I wrote in Slack here so we don't lose it)
While working on this [the "dynamic workspace discovery"] I’ve grown convinced that this “dynamic folder location discovery by using sourcegraph search” could/should also be used for
transformChanges
. In addition to directory: we could allowrootAtLocationOf
and use the same mechanism to auto-discover the folders into which changes should be grouped.)
In more concrete terms: in addition to having this
transformChanges:
group:
- directory: client
branch: hello-world-client # will replace the `branch` in the `changesetTemplate`
- directory: docker-images
repository: github.com/sourcegraph/sourcegraph
branch: hello-world-infra
changesetTemplate:
branch: hello-world # This branch is the default branch and will be overwritten for each additional changeset.
# [...]
we could have something like this:
transformChanges:
group:
# Determine the directory locations using Sourcegraph search
- rootAtLocationOf: package.json
# Allow globbing when specifying the repository name
in: github.com/sourcegraph/automation*
- rootAtLocationOf: README.md
# Stay backwards compatible:
repository: github.com/sourcegraph/sourcegraph
changesetTemplate:
# And we also use templating:
branch: hello-world-${{ transformChanges.group.directory}}
# Could also look like this:
branch: hello-world-${{ changes.directory}}
# [...]