Skip to content

Commit 6c94c75

Browse files
authored
add documentation for supported filters in pr automations (#461)
1 parent 0fc397e commit 6c94c75

File tree

4 files changed

+82
-8
lines changed

4 files changed

+82
-8
lines changed

generated/routes.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
"/getting-started/advanced-config/sandboxing": {
8787
"relPath": "/getting-started/advanced-config/sandboxing.md",
88-
"lastmod": "2025-03-27T19:09:28.000Z"
88+
"lastmod": "2025-05-14T21:43:40.000Z"
8989
},
9090
"/getting-started/advanced-config/network-configuration": {
9191
"relPath": "/getting-started/advanced-config/network-configuration.md",
@@ -125,7 +125,7 @@
125125
},
126126
"/plural-features/continuous-deployment/pipelines": {
127127
"relPath": "/plural-features/continuous-deployment/pipelines.md",
128-
"lastmod": "2025-04-25T13:05:27.000Z"
128+
"lastmod": "2025-05-12T06:30:23.000Z"
129129
},
130130
"/plural-features/k8s-upgrade-assistant": {
131131
"relPath": "/plural-features/k8s-upgrade-assistant/index.md",
@@ -141,7 +141,7 @@
141141
},
142142
"/plural-features/k8s-upgrade-assistant/cluster-drain": {
143143
"relPath": "/plural-features/k8s-upgrade-assistant/cluster-drain.md",
144-
"lastmod": "2025-05-12T20:45:36.000Z"
144+
"lastmod": "2025-05-13T01:49:39.000Z"
145145
},
146146
"/plural-features/stacks-iac-management": {
147147
"relPath": "/plural-features/stacks-iac-management/index.md",
@@ -225,7 +225,7 @@
225225
},
226226
"/plural-features/flows/preview-environments": {
227227
"relPath": "/plural-features/flows/preview-environments.md",
228-
"lastmod": "2025-05-12T00:16:07.000Z"
228+
"lastmod": "2025-05-14T21:43:40.000Z"
229229
},
230230
"/plural-features/flows/mcp": {
231231
"relPath": "/plural-features/flows/mcp.md",
@@ -275,6 +275,10 @@
275275
"relPath": "/plural-features/pr-automation/pipelines.md",
276276
"lastmod": "2025-03-12T14:59:41.000Z"
277277
},
278+
"/plural-features/pr-automation/filters": {
279+
"relPath": "/plural-features/pr-automation/filters.md",
280+
"lastmod": "2025-05-16T14:21:39.979Z"
281+
},
278282
"/plural-features/service-templating": {
279283
"relPath": "/plural-features/service-templating/index.md",
280284
"lastmod": "2025-03-12T14:59:41.000Z"
@@ -285,7 +289,7 @@
285289
},
286290
"/plural-features/projects-and-multi-tenancy": {
287291
"relPath": "/plural-features/projects-and-multi-tenancy/index.md",
288-
"lastmod": "2025-03-12T14:59:41.000Z"
292+
"lastmod": "2025-05-15T21:02:36.000Z"
289293
},
290294
"/plural-features/notifications": {
291295
"relPath": "/plural-features/notifications/index.md",
@@ -421,7 +425,7 @@
421425
},
422426
"/deployments/sandboxing": {
423427
"relPath": "/getting-started/advanced-config/sandboxing.md",
424-
"lastmod": "2025-03-27T19:09:28.000Z"
428+
"lastmod": "2025-05-14T21:43:40.000Z"
425429
},
426430
"/deployments/network-configuration": {
427431
"relPath": "/getting-started/advanced-config/network-configuration.md",
@@ -541,7 +545,7 @@
541545
},
542546
"/deployments/multi-tenancy": {
543547
"relPath": "/plural-features/projects-and-multi-tenancy/index.md",
544-
"lastmod": "2025-03-12T14:59:41.000Z"
548+
"lastmod": "2025-05-15T21:02:36.000Z"
545549
},
546550
"/deployments/notifications": {
547551
"relPath": "/plural-features/notifications/index.md",

pages/plural-features/pr-automation/crds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ You can use our CRD toolkit to generate new PR Automation flows easily. This can
77

88
## Defining Templates
99

10-
Most of the PR automation works off of Shopify's [Liquid](https://shopify.github.io/liquid/) templating engine. It's a well-documented, widely used templating library that frankly is a bit nicer than go's builtin text/template library.
10+
Most of the PR automation works off of Shopify's [Liquid](https://shopify.github.io/liquid/) templating engine. It's a well-documented, widely used templating library that frankly is a bit nicer than go's builtin text/template library. Plural provides a set of custom filters that can be used in your templates. For more information, see [Liquid Filters in PR Automation](filters.md).
1111

1212
For this example there are a few templates that are worth mentioning:
1313

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Liquid Filters in PR Automation
3+
description: Supported Liquid filters for use in PR Automation templates
4+
---
5+
6+
# Liquid Filters in PR Automation
7+
8+
PR Automation in Plural uses [Liquid](https://shopify.github.io/liquid/) templating engine for generating templates. In addition to the standard Liquid filters, Plural provides a set of custom filters that can be used in your templates.
9+
10+
## Supported Filters
11+
12+
Plural supports a wide range of Liquid filters that can be used in your PR Automation templates. These filters include:
13+
14+
- String manipulation (e.g., `abbrev`, `trim`, `upper`, `lower`)
15+
- Mathematical operations (e.g., `add`, `sub`, `mul`, `div`)
16+
- Date formatting (e.g., `date`, `dateInZone`, `dateModify`)
17+
- Data structure manipulation (e.g., `keys`, `values`, `pick`, `omit`)
18+
- Encoding/decoding (e.g., `b64enc`, `b64dec`, `urlquery`)
19+
- And many more
20+
21+
For a complete list of supported filters and detailed documentation for each, please refer to our [Liquid Filters documentation](https://github.com/pluralsh/polly/blob/main/docs/liquid-filters.md).
22+
23+
## Using Filters in Templates
24+
25+
Filters can be used in your Liquid templates to transform data. Here's a simple example:
26+
27+
```liquid
28+
{{ context.name | upper }}
29+
```
30+
31+
This would convert the `context.name` value to uppercase.
32+
33+
You can also chain multiple filters:
34+
35+
```liquid
36+
{{ context.description | trim | truncate: 100 }}
37+
```
38+
39+
This would trim whitespace from `context.description` and then truncate it to 100 characters.
40+
41+
## Examples
42+
43+
Here are a few examples of how you might use these filters in your PR Automation templates:
44+
45+
### String Manipulation
46+
47+
```liquid
48+
{{ context.name | lower | replace: " ", "-" }}
49+
```
50+
51+
This would convert `context.name` to lowercase and replace spaces with hyphens, which is useful for generating URL-friendly slugs.
52+
53+
### Date Formatting
54+
55+
```liquid
56+
{{ "now" | date: "%Y-%m-%d" }}
57+
```
58+
59+
This would output the current date in the format "YYYY-MM-DD".
60+
61+
### Mathematical Operations
62+
63+
```liquid
64+
{{ context.replicas | add: 1 }}
65+
```
66+
67+
This would add 1 to the value of `context.replicas`.
68+
69+
For more examples and detailed documentation, please refer to our [Liquid Filters documentation](https://github.com/pluralsh/polly/blob/main/docs/liquid-filters.md).

src/routing/docs-structure.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export const docsStructure: DocSection[] = [
170170
{ path: 'crds', title: 'PR automation custom resources' },
171171
{ path: 'testing', title: 'PR automation testing' },
172172
{ path: 'pipelines', title: 'PR automation pipelines' },
173+
{ path: 'filters', title: 'Liquid Filters in PR Automation' },
173174
],
174175
},
175176
{

0 commit comments

Comments
 (0)