Skip to content

Commit b674963

Browse files
committed
Update commit_and_push_changes function to add a default commit message
Add a default print logger to prevent exceptions Bump minecode_pipelines version to 0.0.1b24 Signed-off-by: ziad hany <[email protected]>
1 parent 506826a commit b674963

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ android_analysis = [
121121
"android_inspector==0.0.1"
122122
]
123123
mining = [
124-
"minecode_pipelines==0.0.1b23"
124+
"minecode_pipelines==0.0.1b24"
125125
]
126126

127127
[project.urls]

scanpipe/pipes/federatedcode.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,31 @@ def commit_and_push_changes(
198198
commit_message=None,
199199
purls=None,
200200
remote_name="origin",
201-
logger=None,
201+
mine_type="packageURL",
202+
tool_name="pkg:github/aboutcode-org/scancode.io",
203+
tool_version=VERSION,
204+
logger=print
202205
):
203206
"""
204207
Commit and push changes to remote repository.
205208
Returns True if changes are successfully pushed, False otherwise.
206209
"""
210+
211+
if not commit_message:
212+
author_name = settings.FEDERATEDCODE_GIT_SERVICE_NAME
213+
author_email = settings.FEDERATEDCODE_GIT_SERVICE_EMAIL
214+
215+
purls = "\n".join(purls)
216+
commit_message = textwrap.dedent(f"""\
217+
Add {mine_type} results for:
218+
{purls}
219+
220+
Tool: {tool_name}@v{tool_version}
221+
Reference: https://{settings.ALLOWED_HOSTS[0]}
222+
223+
Signed-off-by: {author_name} <{author_email}>
224+
""")
225+
207226
try:
208227
commit_changes(repo, files_to_commit, commit_message, purls, logger)
209228
push_changes(repo, remote_name)

0 commit comments

Comments
 (0)