Skip to content

Commit

Permalink
fix: badge in readme and renovate config
Browse files Browse the repository at this point in the history
  • Loading branch information
M0NsTeRRR committed Nov 22, 2024
1 parent 3181bc6 commit 3533314
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
3 changes: 2 additions & 1 deletion __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
renovatebot_configs = repository_config["renovatebot"].get("configs", [])

if devcontainer and "devcontainer" not in renovatebot_configs:
renovatebot_configs.append("devcontainer")
renovatebot_configs.append("devcontainers")
if helm and "helm" not in renovatebot_configs:
renovatebot_configs.append("helm")
if docker and "docker" not in renovatebot_configs:
Expand All @@ -103,6 +103,7 @@

repository.sync_renovatebot(
repository_config["renovatebot"].get("schedule", None),
language,
renovatebot_configs,
repository_config["renovatebot"].get("additionnal_configs", []),
)
Expand Down
33 changes: 19 additions & 14 deletions src/git_automation/GitRepositoryComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,33 +289,41 @@ def sync_label(self, label_files: List[str]):
def sync_renovatebot(
self,
schedule: str,
language: str,
configs: List[str],
additionnal_configs: List[str],
):
template = env.get_template(os.path.join("renovatebot", "renovatebot.json5.j2"))
template = env.get_template(os.path.join("renovatebot", "renovate.json5.j2"))

self._repository_file(
"renovatebot",
".github/renovatebot.json5",
"renovate",
".github/renovate.json5",
template.render(
owner=self.owner,
repository_name=f"{self.owner}/{self.name}",
schedule=schedule,
configs=configs,
additionnal_configs=additionnal_configs,
),
)

renovatebot_dir = (
renovatebot_config_dir = (
resources.files(PACKAGE_NAME) / "templates" / "renovatebot" / "config"
)
renovatebot_files = os.listdir(renovatebot_dir)
renovatebot_files = os.listdir(renovatebot_config_dir)
for renovatebot_file in renovatebot_files:
with open(renovatebot_dir / renovatebot_file) as file:
renovatebot_content = file.read()
template = env.get_template(
os.path.join("renovatebot", "config", renovatebot_file)
)
filename = os.path.splitext(renovatebot_file)[0]

self._repository_file(
os.path.splitext(renovatebot_file)[0],
f".github/renovatebot/{renovatebot_file}",
renovatebot_content,
filename,
f".github/renovate/{filename}",
template.render(
language=language,
configs=configs,
additionnal_configs=additionnal_configs,
),
)

def sync_logo(self, logo: str):
Expand Down Expand Up @@ -451,9 +459,6 @@ def sync_repository_ruleset(self, versions: List[str], lint: bool, test: bool):
github.RepositoryRulesetRulesRequiredStatusChecksRequiredCheckArgs(
context="DCO"
),
github.RepositoryRulesetRulesRequiredStatusChecksRequiredCheckArgs(
context="GitGuardian Security Checks"
),
github.RepositoryRulesetRulesRequiredStatusChecksRequiredCheckArgs(
context="Validate PR title", integration_id=15368
),
Expand Down
2 changes: 1 addition & 1 deletion src/git_automation/templates/readme/sections/header.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _{{ repository_description }}_
</div>

<div align="center">
{%- if language == "python" and package %}
{% if language == "python" and package %}
[![Pypi](https://img.shields.io/pypi/v/{{ package_name }}?label=&logo=pypi&style=for-the-badge&logoColor=yellow&color=3776AB)](https://pypi.python.org/pypi/{{ package_name }})
[![Python](https://img.shields.io/pypi/pyversions/{{ package_name }}?label=&logo=python&style=for-the-badge&logoColor=yellow&color=3776AB)](https://pypi.python.org/pypi/{{ package_name }})
{%- elif language == "go" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"addLabels": ["renovate/go"]
},
{%- endif %}
{%- if docker %}
{%- if configs["docker"] %}
{
"matchDatasources": ["docker"],
"addLabels": ["renovate/container"]
},
{%- endif %}
{%- if helm %}
{%- if configs["helm"] %}
{
"matchDatasources": ["helm"],
"addLabels": ["renovate/helm"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{%- raw %}
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
Expand Down Expand Up @@ -51,7 +50,7 @@
"commitMessageExtra": "( {{currentVersion}} → {{newVersion}} )"
},
{%- endif %}
{%- if docker %}
{%- if configs["docker"] %}
{
"matchDatasources": ["docker"],
"matchUpdateTypes": ["major"],
Expand Down Expand Up @@ -84,7 +83,7 @@
"commitMessageExtra": "( {{currentDigestShort}} → {{newDigestShort}} )"
},
{%- endif %}
{%- if helm %}
{%- if configs["helm"] %}
{
"matchDatasources": ["helm"],
"matchUpdateTypes": ["major"],
Expand All @@ -110,5 +109,4 @@
},
{%- endif %}
]
}
{%- endraw %}
}

0 comments on commit 3533314

Please sign in to comment.