Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit e06792e

Browse files
committed
describe how context container is created
1 parent 406b183 commit e06792e

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

templates/README.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ ${{{ <context> }}}
2323
| `config` | `object` | Configuration object because of which the file is being copied. For more information, see [config context](#config-context) |
2424
| `github` | `object` | Information about the target repository the file is being copied to. For more information, see [github context](#github-context) |
2525

26+
The context container is generated automatically before template expansion is performed.
27+
2628
#### `config` context
2729

28-
The `config` context is the configuration object because of which the file is being copied.
30+
The `config` context is the configuration object because of which the file is being copied. It is created by merging the `defaults` object with a `repository` object (from the `repositories` array) from a JSON configuration file.
2931

3032
| Property name | Type | Always present | Description |
3133
| --- | --- | --- | --- |
@@ -39,7 +41,7 @@ The `config` context is the configuration object because of which the file is be
3941

4042
#### `github` context
4143

42-
The `github` context contains information about the target repository the file is being copied to.
44+
The `github` context contains information about the target repository the file is being copied to. It is created on the fly before template expansion is performed.
4345

4446
| Property name | Type | Always present | Description |
4547
| --- | --- | --- | --- |
@@ -48,21 +50,45 @@ The `github` context contains information about the target repository the file i
4850

4951
### Examples
5052

53+
#### JSON configuration
54+
55+
```json
56+
{
57+
"defaults": {
58+
"files": [".github/workflows/automerge.yml"],
59+
"is_example": false
60+
},
61+
"repositories": [
62+
{
63+
"target": "protocol/.github-test-target",
64+
"extra_files": [".github/workflows/example.yml"],
65+
"example": {
66+
"greeting": "Hello"
67+
},
68+
"is_example": true
69+
}
70+
]
71+
}
72+
```
73+
5174
#### Context container
5275

76+
*created automatically before template expansion is performed*
77+
5378
```json
5479
{
55-
"config": {
56-
"example": {
57-
"greeting": "Hello"
58-
},
59-
"files": [],
60-
"extra_files": [".github/workflows/example.yml"],
61-
"target": "protocol/.github-test-target"
80+
"config": {
81+
"target": "protocol/.github-test-target",
82+
"files": [".github/workflows/automerge.yml"],
83+
"extra_files": [".github/workflows/example.yml"],
84+
"example": {
85+
"greeting": "Hello"
6286
},
63-
"github": {
64-
"default_branch": "master"
65-
}
87+
"is_example": true
88+
},
89+
"github": {
90+
"default_branch": "master"
91+
}
6692
}
6793
```
6894

0 commit comments

Comments
 (0)