Skip to content

Commit cbb07a7

Browse files
committed
Added source code for a filter for testing the release filters:
- Related Regolith PR: Bedrock-OSS/regolith#321
1 parent 6230216 commit cbb07a7

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

reslease-filters-src/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The filters defined in this directory are used for testing the [release filter feature](https://github.com/Bedrock-OSS/regolith/pull/321).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This filter creates a `BP/hello_release_filter.txt` file and and writes the content of `data/hello-release-filter/message.txt` into it.
2+
3+
The default message is "Hello from hello-release-filter!\n" (and it's stored in the filter's default data in the message.txt file).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello from hello-release-filter!
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"filters": [
3+
{
4+
"runWith": "python",
5+
"script": "./main.py"
6+
}
7+
]
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from pathlib import Path
2+
3+
def main():
4+
with Path("data/hello-release-filter/message.txt").open(
5+
"r", encoding="utf8"
6+
) as f:
7+
message = f.read()
8+
with Path("BP/hello_release_filter.txt").open("w", encoding="utf8") as f:
9+
f.write(message)
10+
11+
if __name__ == '__main__':
12+
main()

0 commit comments

Comments
 (0)