mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🐛 Fix changelog file format
This commit is contained in:
committed by
Nikhil Badyal
parent
2862d40cf0
commit
63ca520990
@@ -99,11 +99,11 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Commit Update file
|
- name: Commit Update file
|
||||||
if: ${{ inputs.COMMIT_CHANGELOG }}
|
if: ${{ inputs.COMMIT_CHANGELOG && !inputs.CI_TEST}}
|
||||||
uses: stefanzweifel/git-auto-commit-action@master
|
uses: stefanzweifel/git-auto-commit-action@master
|
||||||
with:
|
with:
|
||||||
branch: changelogs
|
branch: changelogs
|
||||||
skip_checkout: true
|
skip_checkout: true
|
||||||
file_pattern: 'changelog.md updates.json'
|
file_pattern: 'changelog.md changelog.json updates.json'
|
||||||
commit_message: 🚀New Build
|
commit_message: 🚀New Build
|
||||||
push_options: '--force'
|
push_options: '--force'
|
||||||
|
|||||||
+10
-4
@@ -1,5 +1,6 @@
|
|||||||
"""Utilities."""
|
"""Utilities."""
|
||||||
|
|
||||||
|
import inspect
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -30,6 +31,7 @@ request_header = {
|
|||||||
}
|
}
|
||||||
bs4_parser = "html.parser"
|
bs4_parser = "html.parser"
|
||||||
changelog_file = "changelog.md"
|
changelog_file = "changelog.md"
|
||||||
|
changelog_json_file = "changelog.json"
|
||||||
request_timeout = 60
|
request_timeout = 60
|
||||||
session = Session()
|
session = Session()
|
||||||
session.headers["User-Agent"] = request_header["User-Agent"]
|
session.headers["User-Agent"] = request_header["User-Agent"]
|
||||||
@@ -80,10 +82,12 @@ def format_changelog(name: str, response: dict[str, str]) -> dict[str, str]:
|
|||||||
|
|
||||||
def write_changelog_to_file() -> None:
|
def write_changelog_to_file() -> None:
|
||||||
"""The function `write_changelog_to_file` writes a given changelog json to a file."""
|
"""The function `write_changelog_to_file` writes a given changelog json to a file."""
|
||||||
markdown_table = """
|
markdown_table = inspect.cleandoc(
|
||||||
| Resource Name | Version | Changelog | Published On | Build By|\n
|
|
||||||
|---------------|---------|-----------|--------------|---------|\n
|
|
||||||
"""
|
"""
|
||||||
|
| Resource Name | Version | Changelog | Published On | Build By|
|
||||||
|
|---------------|---------|-----------|--------------|---------|
|
||||||
|
""",
|
||||||
|
)
|
||||||
for app_data in changelogs.values():
|
for app_data in changelogs.values():
|
||||||
name_link = app_data["ResourceName"]
|
name_link = app_data["ResourceName"]
|
||||||
version = app_data["Version"]
|
version = app_data["Version"]
|
||||||
@@ -94,11 +98,13 @@ def write_changelog_to_file() -> None:
|
|||||||
# Clean up changelog for markdown
|
# Clean up changelog for markdown
|
||||||
changelog = changelog.replace("\r\n", "<br>")
|
changelog = changelog.replace("\r\n", "<br>")
|
||||||
changelog = changelog.replace("\n", "<br>")
|
changelog = changelog.replace("\n", "<br>")
|
||||||
|
changelog = changelog.replace("|", "\\|")
|
||||||
|
|
||||||
# Add row to the Markdown table string
|
# Add row to the Markdown table string
|
||||||
markdown_table += f"| {name_link} | {version} | {changelog} | {published_at} | {built_by} |\n"
|
markdown_table += f"\n| {name_link} | {version} | {changelog} | {published_at} | {built_by} |"
|
||||||
with Path(changelog_file).open("w", encoding="utf_8") as file1:
|
with Path(changelog_file).open("w", encoding="utf_8") as file1:
|
||||||
file1.write(markdown_table)
|
file1.write(markdown_table)
|
||||||
|
Path(changelog_json_file).write_text(json.dumps(changelogs, indent=4) + "\n")
|
||||||
|
|
||||||
|
|
||||||
def get_parent_repo() -> str:
|
def get_parent_repo() -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user