Automation is currently available in private beta for select enterprise customers.
Sourcegraph automation allows large-scale code changes across many repositories and different code hosts.
In order to use the Automation preview, a site-admin of your Sourcegraph instance must enable it in the site configuration settings e.g. sourcegraph.example.com/site-admin/configuration
{ "experimentalFeatures": { "automation": "enabled" } }
Automation requires that your external service is using a token with write access in order to create changesets on your code host.
Our focus is to deliver general functionality (e.g., centralized monitoring of a large set of pull requests on different codehosts) as well as tailored solutions for large-scale code changes and workflows (e.g., detect leaked NPM credentials). If you have a specific automation workflow in mind that is not covered by our current feature set, please reach out to us at [email protected].
Manual campaigns keep track of existing changesets from various code hosts. You will manually add each changeset you would like to track (such as a GitHub pull request), and can track them to completion.
We currently offer search and replace functionality using Comby, which is a tailored solution for syntactic, lint-like code changes (if you're interested in general text or regex search and replace then stay tuned, it's in the works!)
Run Comby across all of your repositories that match a specified scope query. Currently GitHub and Bitbucket Server are supported Codehosts for this campaign type. Other repositories won't be matched by the
scopeQuery
parameter. Also, a maximum of 200 repositories applies at this time.
Parameters:
Name | Description |
---|---|
scopeQuery | Search query to narrow down repositories to be included in this campaign. |
matchTemplate | The template to match against in source files. See the Comby documentation for syntax. |
rewriteTemplate | The template to use for the replacements. See the Comby documentation for syntax. |
Note: the scopeQuery
filter narrows the set of repositories to run on, and will then run across all files in the repository. Future improvements will allow further scoping by file name and file contents.
We are actively working on campaign support for regex search and replace. Let us know if this is a feature you are especially excited for!
sourcegraph.example.com/campaigns
or simply click the "Campaigns" entry in the top navbar. (It will only appear when correctly configured).If you are looking to run automation on a larger scale in the local dev environment, follow the guide on automation development.