From 912d1d21cc9cde92a605ee503a6668ad56708261 Mon Sep 17 00:00:00 2001 From: Michael Bahr Date: Wed, 19 Mar 2025 10:44:23 +0100 Subject: [PATCH 1/2] docs for batches library --- docs/admin/config/batch_changes.mdx | 27 +++++++++++++++++++ docs/batch-changes/create-a-batch-change.mdx | 2 +- .../site-admin-configuration.mdx | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/admin/config/batch_changes.mdx b/docs/admin/config/batch_changes.mdx index 0da626424..232ba807d 100644 --- a/docs/admin/config/batch_changes.mdx +++ b/docs/admin/config/batch_changes.mdx @@ -306,3 +306,30 @@ When a user is deleted, their Batch Changes become inaccessible in the UI but th This allows recovering the Batch Changes if the user is restored. However, if the user deletion is permanent, deleting both account and data, then the associated Batch Changes are also permanently deleted from the database. This frees storage space and removes dangling references. + +## Batch Spec Library + +The Batch Spec Library is a collection of Batch Specs that can be used to create Batch Changes. Sourcegraph provides a few Batch Specs out of the box. + +Site admins can manage the library through the GraphQL mutations `createBatchSpecLibraryRecord`, `updateBatchSpecLibraryRecord`, and `deleteBatchSpecLibraryRecord`. Use the query `batchSpecLibrary` to list all available Batch Spec examples. + +```graphql +createBatchSpecLibraryRecord(name: "example", spec: "version: 2\nname: example") { + id +} + +updateBatchSpecLibraryRecord(id: "QmF0Y2hTcGVjTGlicmFyeVJlY29yZDo4", name: "example-2", spec: "version: 2\nname: example-2") { + id +} + +deleteBatchSpecLibraryRecord(id: "QmF0Y2hTcGVjTGlicmFyeVJlY29yZDo4") { + alwaysNil +} + +batchSpecLibrary(first: 100) { + nodes { + id + name + } +} +``` diff --git a/docs/batch-changes/create-a-batch-change.mdx b/docs/batch-changes/create-a-batch-change.mdx index 64a7c4bd1..1728d0bb1 100644 --- a/docs/batch-changes/create-a-batch-change.mdx +++ b/docs/batch-changes/create-a-batch-change.mdx @@ -140,7 +140,7 @@ You should see the editor view now. This view consists of three main areas: ![ssbc_editor_panels](https://sourcegraphstatic.com/docs/images/batch_changes/2024/ssbc_editor_panels.png) -You can pick from the examples in the library pane to get started quickly or begin working on your batch spec in the editor right away. The editor will provide documentation as you hover over tokens in the YAML spec and supports auto-completion. +You can pick from the examples in the library pane to get started quickly or begin working on your batch spec in the editor right away. Site admins can configure the examples. The editor will provide documentation as you hover over tokens in the YAML spec and supports auto-completion. ### Previewing workspaces diff --git a/docs/batch-changes/site-admin-configuration.mdx b/docs/batch-changes/site-admin-configuration.mdx index b7cbb95ba..976014c2e 100644 --- a/docs/batch-changes/site-admin-configuration.mdx +++ b/docs/batch-changes/site-admin-configuration.mdx @@ -17,6 +17,7 @@ Using Batch Changes requires a [code host connection](/admin/external_services/) - [Outgoing webhooks](/admin/config/webhooks/outgoing), which publish events related to batch changes and changesets to enable deeper integrations with your other tools and systems - [Auto-delete branch on merge/close](/admin/config/batch_changes#automatically-delete-branches-on-merge-close), which automatically deletes branches created by Batch Changes when changesets are merged or closed - [Commit signing for GitHub](/admin/config/batch_changes#commit-signing-for-github), which signs commits created by Batch Changes via a GitHub App (Beta) + - [Batch spec examples](/admin/config/batch_changes#batch-spec-examples), which help your users write batch specs and follow best practices ## Disable Batch Changes From 6896e3d9997749707e5e349222906b8541b8232e Mon Sep 17 00:00:00 2001 From: Michael Bahr Date: Wed, 19 Mar 2025 10:46:45 +0100 Subject: [PATCH 2/2] update link --- docs/batch-changes/site-admin-configuration.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/batch-changes/site-admin-configuration.mdx b/docs/batch-changes/site-admin-configuration.mdx index 976014c2e..57ef2a0f2 100644 --- a/docs/batch-changes/site-admin-configuration.mdx +++ b/docs/batch-changes/site-admin-configuration.mdx @@ -17,7 +17,7 @@ Using Batch Changes requires a [code host connection](/admin/external_services/) - [Outgoing webhooks](/admin/config/webhooks/outgoing), which publish events related to batch changes and changesets to enable deeper integrations with your other tools and systems - [Auto-delete branch on merge/close](/admin/config/batch_changes#automatically-delete-branches-on-merge-close), which automatically deletes branches created by Batch Changes when changesets are merged or closed - [Commit signing for GitHub](/admin/config/batch_changes#commit-signing-for-github), which signs commits created by Batch Changes via a GitHub App (Beta) - - [Batch spec examples](/admin/config/batch_changes#batch-spec-examples), which help your users write batch specs and follow best practices + - [Batch spec library](/admin/config/batch_changes#batch-spec-library), which help your users write batch specs and follow best practices ## Disable Batch Changes