Skip to content

Commit

Permalink
fix: Fix parsing rule
Browse files Browse the repository at this point in the history
  • Loading branch information
mckrava committed Apr 20, 2022
1 parent 06c1d4f commit 23ca3c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 anmarkoulis
Copyright (c) 2022 mckrava

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import os
import re


TAG_NAME = os.getenv("INPUT_TAG_NAME").split("refs/tags/")[1]
PATH_TO_CHANGELOG = os.getenv("INPUT_CHANGELOG")
Expand All @@ -16,12 +18,13 @@ def get_changelog_lines():
all_lines = read_file.readlines()
changelog_lines = []
read_line = False

for line in all_lines:
if f"## {TAG_NAME}" or f"## [{TAG_NAME}]" or f"### {TAG_NAME}" or f"### [{TAG_NAME}]" in line:
if line.find(f"## {TAG_NAME}") != -1 or line.find(f"## [{TAG_NAME}]") != -1 or line.find(f"### {TAG_NAME}") != -1 or line.find(f"### [{TAG_NAME}]") != -1:
read_line = True
continue
if read_line:
if f"## {TAG_NAME}" or f"## [{TAG_NAME}]" or f"### {TAG_NAME}" or f"### [{TAG_NAME}]" in line:
if re.search(r'^###?\s\[?\d.\d.\d', line):
break
else:
changelog_lines.append(line)
Expand Down

0 comments on commit 23ca3c8

Please sign in to comment.