Skip to content

Commit

Permalink
add if __main__ to changelog filter (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Feb 27, 2024
1 parent 1043d38 commit 788bfd9
Showing 1 changed file with 12 additions and 11 deletions.
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))

0 comments on commit 788bfd9

Please sign in to comment.