Skip to content

Commit 0052db5

Browse files
committed
fix fragment links for batch-spec-yaml-reference
1 parent 43ed7d9 commit 0052db5

12 files changed

+2199
-2668
lines changed

docs/batch-changes/batch-spec-templating.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ run: goimports -w cmd/src/main.go internal/fmt/fmt.go
4343

4444
Templating is supported in the following fields:
4545

46-
- [`steps.run`](/batch-changes/batch-spec-yaml-reference#steps-run)
47-
- [`steps.env`](/batch-changes/batch-spec-yaml-reference#steps-env) values
48-
- [`steps.files`](/batch-changes/batch-spec-yaml-reference#steps-files) values
49-
- [`steps.outputs.<name>.value`](/batch-changes/batch-spec-yaml-reference#steps-outputs)
50-
- [`steps.if`](/batch-changes/batch-spec-yaml-reference#steps-if)
51-
- [`changesetTemplate.title`](/batch-changes/batch-spec-yaml-reference#changesettemplate-title)
52-
- [`changesetTemplate.body`](/batch-changes/batch-spec-yaml-reference#changesettemplate-body)
53-
- [`changesetTemplate.branch`](/batch-changes/batch-spec-yaml-reference#changesettemplate-branch)
54-
- [`changesetTemplate.commit.message`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-message)
55-
- [`changesetTemplate.commit.author.name`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-author)
56-
- [`changesetTemplate.commit.author.email`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-author)
46+
- [`steps.run`](/batch-changes/batch-spec-yaml-reference#stepsrun)
47+
- [`steps.env`](/batch-changes/batch-spec-yaml-reference#stepsenv) values
48+
- [`steps.files`](/batch-changes/batch-spec-yaml-reference#stepsfiles) values
49+
- [`steps.outputs.<name>.value`](/batch-changes/batch-spec-yaml-reference#stepsoutputsnamevalue)
50+
- [`steps.if`](/batch-changes/batch-spec-yaml-reference#stepsif)
51+
- [`changesetTemplate.title`](/batch-changes/batch-spec-yaml-reference#changesettemplatetitle)
52+
- [`changesetTemplate.body`](/batch-changes/batch-spec-yaml-reference#changesettemplatebody)
53+
- [`changesetTemplate.branch`](/batch-changes/batch-spec-yaml-reference#changesettemplatebranch)
54+
- [`changesetTemplate.commit.message`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitmessage)
55+
- [`changesetTemplate.commit.author.name`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitauthor)
56+
- [`changesetTemplate.commit.author.email`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitauthor)
5757

5858
## Template variables
5959

@@ -102,7 +102,7 @@ The following template variables are available in the fields under `changesetTem
102102
| `steps.added_files` | `list of strings` | List of files that have been added by the `steps`. Empty list if no files have been added |
103103
| `steps.deleted_files` | `list of strings` | List of files deleted by the `steps`. Empty list if no files have been deleted |
104104
| `steps.path` | `string` | Path (relative to the root of the directory, no leading `/` or `.`) in which the `steps` have been executed. Empty if no workspaces have been used and the `steps` were executed in the root of the repository |
105-
| `outputs.<name>` | depends on `outputs.<name>.format`, default: `string` | Value of an [`output`](/batch-changes/batch-spec-yaml-reference#steps-outputs) set by `steps`. If the [`outputs.<name>.format`](batch_spec_yaml_reference#steps-outputs-format) is `yaml` or `json` and the `value` a data structure (i.e., array, object, ...), then subfields can be accessed too. See [Templating Examples](#templating-examples) below |
105+
| `outputs.<name>` | depends on `outputs.<name>.format`, default: `string` | Value of an [`output`](batch-spec-yaml-reference#stepsoutputs) set by `steps`. If the [`outputs.<name>.format`](batch-spec-yaml-reference#stepsoutputsnameformat) is `yaml` or `json` and the `value` a data structure (i.e., array, object, ...), then subfields can be accessed too. See [Templating Examples](#templating-examples) below |
106106
| `batch_change_link` | `string` | <strong><small>Only available in `changesetTemplate.body`</small></strong><br />Link back to the batch change that produced the changeset on Sourcegraph. If omitted, the link will be automatically appended to the end of the body. <br />Requires [Sourcegraph CLI](/cli/) 3.40.9 or later |
107107

108108
## Template helper functions
@@ -212,7 +212,7 @@ changesetTemplate:
212212
The second step left this one: ${{ outputs.otherMessage }}
213213
```
214214

215-
Using the [`steps.outputs.<name>.format`](/batch-changes/batch-spec-yaml-reference#steps-outputs-name-format) field, it's possible to parse the value of output as JSON or YAML and access it as a data structure instead of just text:
215+
Using the [`steps.outputs.<name>.format`](/batch-changes/batch-spec-yaml-reference#stepsoutputsnameformat) field, it's possible to parse the value of output as JSON or YAML and access it as a data structure instead of just text:
216216

217217
```yaml
218218
steps:
@@ -244,7 +244,7 @@ changesetTemplate:
244244
${{ end }}
245245
```
246246
247-
Using the [`steps.if`](/batch-changes/batch-spec-yaml-reference#steps-if) field to conditionally execute different steps in different repositories:
247+
Using the [`steps.if`](/batch-changes/batch-spec-yaml-reference#stepsif) field to conditionally execute different steps in different repositories:
248248

249249
```yaml
250250
steps:

docs/batch-changes/bulk-operations-on-changesets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Below is a list of supported bulk operations for changesets and the conditions w
3535
| **Re-enqueue** | Re-enqueues the pending changes for all selected changesets that failed |
3636
| **Merge (experimental)** | Merge the selected changesets on code hosts. Some changesets may be unmergeable due to their states, which does not impact the overall bulk operation. Failed merges are listed under the bulk operations tab. In the confirmation modal, you can opt for a squash merge strategy, available on GitHub, GitLab, and Bitbucket Cloud. For Bitbucket Server/Data Center, only regular merges are performed |
3737
| **Close** | Close the selected changesets on the code hosts |
38-
| **Publish** | Publishes the selected changesets, provided they don't have a [`published` field](/batch-changes/batch-spec-yaml-reference#changesettemplate-published) in the batch spec. You can choose between draft and normal changesets in the confirmation modal |
38+
| **Publish** | Publishes the selected changesets, provided they don't have a [`published` field](/batch-changes/batch-spec-yaml-reference#changesettemplatepublished) in the batch spec. You can choose between draft and normal changesets in the confirmation modal |
3939
| **Export** | Export selected changesets that you can use for later use |
4040

4141
## Monitoring bulk operations

docs/batch-changes/create-a-batch-change.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ changesetTemplate:
4949
published: false # Do not publish any changes to the code hosts yet
5050
```
5151
52-
The commits created from your spec will use the `git config` values for `user.name` and `user.email` from your local environment or `[email protected]` if no user is set. Alternatively, you can also [specify an `author`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-author) in this spec.
52+
The commits created from your spec will use the `git config` values for `user.name` and `user.email` from your local environment or `[email protected]` if no user is set. Alternatively, you can also [specify an `author`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitauthor) in this spec.
5353

5454
<Callout type="info">See the [batch spec YAML reference](/batch-changes/batch-spec-yaml-reference) for more details on how to write batch specs.</Callout>
5555

docs/batch-changes/faq.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ There's a rule of thumb:
6060
## Can I create tickets or issues along with Batch Changes?
6161

6262
Batch Changes does not support a declarative syntax for issues or tickets.
63-
However, [steps](/batch-changes/batch-spec-yaml-reference#steps-run) can run any container. Some users have built scripts to create tickets for each apply:
63+
However, [steps](/batch-changes/batch-spec-yaml-reference#stepsrun) can run any container. Some users have built scripts to create tickets for each apply:
6464

6565
- [Jira tickets](https://github.com/sourcegraph/batch-change-examples/blob/main/ticketing-systems/jira-tickets/README)
6666
- [GitHub issues](https://github.com/sourcegraph/batch-change-examples/blob/main/ticketing-systems/github-issues/README)
@@ -84,7 +84,7 @@ Unapplied batch specs are removed from the database after **seven days**.
8484

8585
Yes. When [executing a batch spec](/batch-changes/how-src-executes-a-batch-spec), `src` will attempt to pull missing docker images. If you are logged into the private container registry, it will pull from it.
8686

87-
Also, see [`steps.container`](/batch-changes/batch-spec-yaml-reference#steps-container). Within the spec, it will work as expected if `docker pulls` points to your private registry from the command line.
87+
Also, see [`steps.container`](/batch-changes/batch-spec-yaml-reference#stepscontainer). Within the spec, it will work as expected if `docker pulls` points to your private registry from the command line.
8888

8989
However, outside the spec, `src` pulls an image from Docker Hub when running in volume workspace mode. This is the default on macOS, so you will need to use one of the following three workarounds:
9090

@@ -136,14 +136,14 @@ Remember the context in which the inner `${{ }}` will be evaluated, and be sure
136136

137137
## How is commit author determined for commits produced from Batch Changes?
138138

139-
Commit author is determined when running `src batch [apply|preview]`. If no [author](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-author) key is defined in the batch spec, `src` will try to use the git config values for `user.name` and `user.email` from your local environment, or `[email protected]` if no user is set.
139+
Commit author is determined when running `src batch [apply|preview]`. If no [author](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitauthor) key is defined in the batch spec, `src` will try to use the git config values for `user.name` and `user.email` from your local environment, or `[email protected]` if no user is set.
140140

141141
## Why is the checkbox on my changeset disabled when previewing a batch change?
142142

143143
Since Sourcegraph 3.31, it is possible to publish many types of changesets when previewing a batch change by modifying the publication state for the changeset directly from the UI (see ["Publishing changesets"](/batch-changes/publishing-changesets#from-the-preview)). However, not every changeset can be published by Sourcegraph. By hovering over your changeset's disabled checkbox, you can see why that specific changeset is not currently publishable. The most common reasons include:
144144

145145
- The changeset is already published (we cannot unpublish a changeset or convert it back to a draft)
146-
- The changeset's publication state is being controlled from your batch spec file (i.e., you have the [`published` flag set in your batch spec](/batch-changes/batch-spec-yaml-reference#changesettemplate-published)); the batch spec takes precedence over the UI
146+
- The changeset's publication state is being controlled from your batch spec file (i.e., you have the [`published` flag set in your batch spec](/batch-changes/batch-spec-yaml-reference#changesettemplatepublished)); the batch spec takes precedence over the UI
147147
- You do not have permission to publish to the repository the changeset would be opened against
148148
- The changeset was imported (and was therefore already published by someone or something else)
149149

docs/batch-changes/publishing-changesets.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ changesetTemplate:
109109
Then run the `src batch preview` command again or `src batch apply` to publish the changesets immediately. Publishing a changeset will:
110110

111111
- Create a commit with the changes from the patches for that repository
112-
- Push a branch using the branch name you defined in the batch spec with [`changesetTemplate.branch`](/batch-changes/batch-spec-yaml-reference#changesettemplate-branch). If [forks are enabled](/admin/config/batch_changes#forks), then the branch will be pushed to a fork of the repository
112+
- Push a branch using the branch name you defined in the batch spec with [`changesetTemplate.branch`](/batch-changes/batch-spec-yaml-reference#changesettemplatebranch). If [forks are enabled](/admin/config/batch_changes#forks), then the branch will be pushed to a fork of the repository
113113
- Create a changeset (e.g., GitHub pull request) on the code host for review and merging
114114

115115
<Callout type="note">When pushing the branch Sourcegraph will use a **force push**. Make sure that the branch names are unused otherwise, previous commits will be overwritten.</Callout>
@@ -135,7 +135,7 @@ changesetTemplate:
135135
- github.com/sourcegraph-private/*: false
136136
```
137137

138-
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplate-published) in the batch spec reference for more details.</Callout>
138+
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplatepublished) in the batch spec reference for more details.</Callout>
139139

140140
### Publishing changesets as drafts
141141

@@ -149,13 +149,13 @@ changesetTemplate:
149149
published: draft
150150
```
151151

152-
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplate-published) in the batch spec reference for more details.</Callout>
152+
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplatepublished) in the batch spec reference for more details.</Callout>
153153

154154
### Fully publishing draft changesets
155155

156156
If you have previously published changesets as drafts on code hosts by setting `published` to `draft`, you then fully publish them and take them out of draft mode by updating the `published` to `true`.
157157

158-
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplate-published) in the batch spec reference for more details.</Callout>
158+
<Callout type="info">See [`changesetTemplate.published`](/batch-changes/batch-spec-yaml-reference#changesettemplatepublished) in the batch spec reference for more details.</Callout>
159159

160160
## Within the UI
161161

@@ -193,4 +193,4 @@ Once applied, you can select the changesets you want to publish from the batch c
193193

194194
Regardless of how you publish your changesets, the commit created and pushed to the branch uses the details specified in the batch spec's `changesetTemplate` field.
195195

196-
<Callout type="info">See [`changesetTemplate.commit`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit) for details on how to set the author and the commit message.</Callout>
196+
<Callout type="info">See [`changesetTemplate.commit`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommit) for details on how to set the author and the commit message.</Callout>

docs/batch-changes/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ changesetTemplate:
6666
message: Append Hello World to all README files
6767
```
6868
69-
The commits you create here will use the `git config` values for `user.name` and `user.email` from your local environment or `[email protected]` if no user is set. Alternatively, you can also [specify an `author`](/batch-changes/batch-spec-yaml-reference#changesettemplate-commit-author) in this spec.
69+
The commits you create here will use the `git config` values for `user.name` and `user.email` from your local environment or `[email protected]` if no user is set. Alternatively, you can also [specify an `author`](/batch-changes/batch-spec-yaml-reference#changesettemplatecommitauthor) in this spec.
7070

7171
## Create the batch change
7272

docs/batch-changes/reexecuting-batch-specs-multiple-times.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In practical terms, a user should be able to run `src batch apply -f my.batch.ya
1414

1515
That can only work if the inputs to the batch spec stay the same, too.
1616

17-
Since a batch spec's [`on.repositoriesMatchingQuery`](/batch-changes/batch-spec-yaml-reference#on-repositoriesmatchingquery) uses Sourcegraph's search functionality to **dynamically** produce a list of repositories in which to execute the [`steps`](/batch-changes/batch-spec-yaml-reference#steps), the list of repositories might change between executions of `src batch apply`.
17+
Since a batch spec's [`on.repositoriesMatchingQuery`](/batch-changes/batch-spec-yaml-reference#onrepositoriesmatchingquery) uses Sourcegraph's search functionality to **dynamically** produce a list of repositories in which to execute the [`steps`](/batch-changes/batch-spec-yaml-reference#steps), the list of repositories might change between executions of `src batch apply`.
1818

1919
If that's the case, the `steps` need to be re-executed in any newly found repositories. Changesets in repositories that are not found anymore will be closed and archived in the batch change (see [Updating a batch change](/batch-changes/update-a-batch-change) for more details). In unchanged repositories, [Sourcegraph CLI](/cli/) tries to use cached results to avoid re-executing the `steps`.
2020

@@ -25,8 +25,8 @@ Whenever [Sourcegraph CLI](/cli/) re-executes the same batch spec, it checks a *
2525
Whether a cached result can be used is dependent on multiple things:
2626

2727
- The repository's default branch's revision didn't change (because if new commits have been pushed to the repository, re-executing the `steps` might lead to different results)
28-
- The `steps` themselves didn't change, including all their inputs, such as [`steps.env`](/batch-changes/batch-spec-yaml-reference#environment-array), and the `steps.run` field (which can change between executions if it uses [templating](/batch-changes/batch-spec-templating) and is dynamically built from search results)
28+
- The `steps` themselves didn't change, including all their inputs, such as [`steps.env`](/batch-changes/batch-spec-yaml-reference#environmentarray), and the `steps.run` field (which can change between executions if it uses [templating](/batch-changes/batch-spec-templating) and is dynamically built from search results)
2929

3030
That also means that [Sourcegraph CLI](/cli/) can use cached results when re-executing a **changed batch spec**, as long as the changes didn't affect the `steps` and the results they produce.
3131

32-
For example, if only the [`changesetTemplate.title`](/batch-changes/batch-spec-yaml-reference#changesettemplate-title) field has been changed, cached results can be used, since that field doesn't have any influence on the `steps` and their results.
32+
For example, if only the [`changesetTemplate.title`](/batch-changes/batch-spec-yaml-reference#changesettemplatetitle) field has been changed, cached results can be used, since that field doesn't have any influence on the `steps` and their results.

0 commit comments

Comments
 (0)