Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add if __main__ to changelog filter #338

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/changelog_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
import sys
import json

input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
source = input_stream.read()
doc = json.loads(source)
if __name__ == '__main__':
input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
source = input_stream.read()
doc = json.loads(source)

output_blocks = []
for block in doc["blocks"]:
if output_blocks and block["t"] == "Header" and block["c"][0] == 1:
break
print(block["c"], file=sys.stderr)
output_blocks.append(block)
output_blocks = []
for block in doc["blocks"]:
if output_blocks and block["t"] == "Header" and block["c"][0] == 1:
break
print(block["c"], file=sys.stderr)
output_blocks.append(block)

doc["blocks"] = output_blocks
sys.stdout.write(json.dumps(doc))
doc["blocks"] = output_blocks
sys.stdout.write(json.dumps(doc))