Refactoring CHANGELOG generation process
This commit is contained in:
parent
4a59bc6e88
commit
3fd905e3fa
|
@ -0,0 +1,12 @@
|
||||||
|
## v0.1.0 (2024-04-20)
|
||||||
|
|
||||||
|
* Refactoring draft notes generation [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/6bb0da8f79b97e1a59b77cb59ba206db1cea9574)
|
||||||
|
* Refactoring draft notes generation [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/a41ce583d39926b39f2ca4c10f4f901f8952e005)
|
||||||
|
* fixing errcheck errors [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/1ff8fde8384a34b2286918cd194ba081addfdf83)
|
||||||
|
* Adding a new flag [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/555dbc2e0ddcc4b4c256407883c2486ae750b680)
|
||||||
|
* Adding woodpecker build files [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/879f7473942b3f6cbef79af909d3edc1c5d736cc)
|
||||||
|
* Able to scrape lyrics from Google Search [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/38f64dcb9293ee5fce323d14083be9cc8d75e918)
|
||||||
|
* Adding LICENSE [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/a17fe93f2ef8320db4d20cb9c7cab4a0888ea295)
|
||||||
|
* Adding simple Makefile [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/23f3d3b1356e89c03114cf8ee840d8df18f98ef2)
|
||||||
|
* Initial config [View](https://git.iratusmachina.com/iratusmachina/lyricdownloader/commits/a4284d56ec78356a5a152e3cc860eed2c5957f1e)
|
||||||
|
|
|
@ -21,21 +21,35 @@ def full():
|
||||||
# Remove the first occurence of the word git starting from the end of the string
|
# Remove the first occurence of the word git starting from the end of the string
|
||||||
remote_url = remote_url[0:remote_url.rfind(".git")]
|
remote_url = remote_url[0:remote_url.rfind(".git")]
|
||||||
previous_tag = ""
|
previous_tag = ""
|
||||||
for tag in tags:
|
if len(tags) == 1:
|
||||||
if previous_tag:
|
# Extract the date of the commit
|
||||||
# Extract the date of the commit
|
tag_date = subprocess.check_output(["git", "log", "-1", f"--pretty=format:'%ad'", "--date=short", f"{tags[0]}"], text=True)
|
||||||
tag_date = subprocess.check_output(["git", "log", "-1", f"--pretty=format:'%ad'", "--date=short", f"{tag}"], text=True)
|
tag_date = tag_date.replace("'", "")
|
||||||
tag_date = tag_date.replace("'", "")
|
|
||||||
|
|
||||||
# Get each commit of a tag formatted
|
# Get each commit of a tag formatted
|
||||||
formatted_lines = subprocess.check_output(["git", "log", f"{tag}...{previous_tag}", f'--pretty=format:"* %s [View]({remote_url}/commits/%H)"'], text=True)
|
formatted_lines = subprocess.check_output(["git", "log", f"{tags[0]}", f'--pretty=format:"* %s [View]({remote_url}/commits/%H)"'], text=True)
|
||||||
if formatted_lines:
|
if formatted_lines:
|
||||||
fw.write(f"## {tag} ({tag_date})\n\n")
|
fw.write(f"## {tags[0]} ({tag_date})\n\n")
|
||||||
# Remove merge commits or Changelog commits
|
# Remove merge commits or Changelog commits
|
||||||
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()])])
|
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(lines)
|
||||||
fw.write("\n\n")
|
fw.write("\n\n")
|
||||||
previous_tag = tag
|
else:
|
||||||
|
for tag in tags:
|
||||||
|
if previous_tag:
|
||||||
|
# Extract the date of the commit
|
||||||
|
tag_date = subprocess.check_output(["git", "log", "-1", f"--pretty=format:'%ad'", "--date=short", f"{tag}"], text=True)
|
||||||
|
tag_date = tag_date.replace("'", "")
|
||||||
|
|
||||||
|
# Get each commit of a tag formatted
|
||||||
|
formatted_lines = subprocess.check_output(["git", "log", f"{tag}...{previous_tag}", f'--pretty=format:"* %s [View]({remote_url}/commits/%H)"'], text=True)
|
||||||
|
if formatted_lines:
|
||||||
|
fw.write(f"## {tag} ({tag_date})\n\n")
|
||||||
|
# Remove merge commits or Changelog commits
|
||||||
|
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")
|
||||||
|
previous_tag = tag
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Command failed with return code {e.returncode}")
|
print(f"Command failed with return code {e.returncode}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue