Compare commits

...

2 Commits

Author SHA1 Message Date
iratusmachina c2f3602163 Merge pull request 'Refactoring draft notes generation' (#3) from feature/refactoring into main
Reviewed-on: #3
2024-04-20 11:25:03 +00:00
iratusmachina a41ce583d3 Refactoring draft notes generation
ci/woodpecker/pr/pr/1 Pipeline was successful Details
ci/woodpecker/pr/pr/2 Pipeline was successful Details
2024-04-20 07:21:36 -04:00
3 changed files with 16 additions and 10 deletions

2
.gitignore vendored
View File

@ -2,4 +2,4 @@
bin
*.txt
artifacts
bin
draft_notes.md

View File

@ -25,7 +25,7 @@ fmt:
.PHONY: lint
lint:
golangci-lint run
golangci-lint run --timeout 3m --verbose
.PHONY: build
build:

View File

@ -49,14 +49,20 @@ def draft():
# Get the current and previous tags
tags = subprocess.check_output(["git", "tag", "--sort=creatordate"], text=True)
tags = [tag for tag in tags.split("\n") if tag]
tags.reverse()
current_tag, previous_tag, *_ = tags
formatted_lines = subprocess.check_output(["git", "log", f"{current_tag}...{previous_tag}", f'--pretty=format:"* %s"'], text=True)
lines = "\n".join([line.replace("\"", "") for line in formatted_lines.split("\n") if all(["merge" not in line.lower(), "changelog.md" not in line.lower()])])
fw.write(lines)
fw.write("\n\n")
fw.write(f"Compare between recent changes: [{previous_tag[1:]}...{current_tag[1:]}]({remote_url}/compare/{previous_tag}...{current_tag})")
if tags:
tags = [tag for tag in tags.split("\n") if tag]
tags.reverse()
current_tag, previous_tag, *_ = tags
formatted_lines = subprocess.check_output(["git", "log", f"{current_tag}...{previous_tag}", f'--pretty=format:"* %s"'], text=True)
lines = "\n".join([line.replace("\"", "") for line in formatted_lines.split("\n") if all(["merge" not in line.lower(), "changelog.md" not in line.lower()])])
fw.write(lines)
fw.write("\n\n")
fw.write(f"Compare between recent changes: [{previous_tag[1:]}...{current_tag[1:]}]({remote_url}/compare/{previous_tag}...{current_tag})")
else:
# first tag
formatted_lines = subprocess.check_output(["git", "log", f'--pretty=format:"* %s"'], text=True)
lines = "\n".join([line.replace("\"", "") for line in formatted_lines.split("\n") if all(["merge" not in line.lower(), "changelog.md" not in line.lower()])])
fw.write(lines)
except subprocess.CalledProcessError as e:
print(f"Command failed with return code {e.returncode}")