2828from aboutcode .hashid import get_core_purl
2929from packageurl import PackageURL
3030
31- from minecode_pipelines .miners .swift import fetch_git_tags_raw , get_tags_and_commits_from_git_output
31+ from minecode_pipelines .miners .swift import fetch_git_tags_raw
32+ from minecode_pipelines .miners .swift import get_tags_and_commits_from_git_output
3233from minecode_pipelines .miners .swift import split_org_repo
3334
3435from minecode_pipelines .pipes import update_checkpoints_in_github
3839from minecode_pipelines .pipes import get_checkpoint_from_file
3940from scanpipe .pipes .federatedcode import clone_repository
4041
41- from scanpipe .pipes .federatedcode import commit_changes
42- from scanpipe .pipes .federatedcode import push_changes
43- from minecode_pipelines import VERSION
42+ from scanpipe .pipes .federatedcode import commit_and_push_changes
4443from minecode_pipelines .utils import cycle_from_index
4544
4645PACKAGE_BATCH_SIZE = 100
4948MINECODE_DATA_SWIFT_REPO = os .environ .get (
5049 "MINECODE_DATA_SWIFT_REPO" , "https://github.com/aboutcode-data/minecode-data-swift-test"
5150)
52- MINECODE_SWIFT_INDEX_REPO = "https://github.com/SwiftPackageIndex/"
51+ MINECODE_SWIFT_INDEX_REPO = "https://github.com/SwiftPackageIndex/PackageList "
5352
5453
5554def store_swift_packages (package_repo_url , tags_and_commits , cloned_data_repo ):
@@ -133,16 +132,13 @@ def mine_and_publish_swift_packageurls(logger):
133132 counter += 1
134133
135134 if counter >= PACKAGE_BATCH_SIZE :
136- commit_changes (
137- repo = cloned_data_repo ,
138- files_to_commit = purl_files ,
139- purls = purls ,
140- mine_type = "packageURL" ,
141- tool_name = "pkg:pypi/minecode-pipelines" ,
142- tool_version = VERSION ,
143- )
135+ if purls and purl_files :
136+ commit_and_push_changes (
137+ repo = cloned_data_repo ,
138+ files_to_commit = purl_files ,
139+ purls = purls ,
140+ )
144141
145- push_changes (repo = cloned_data_repo )
146142 purl_files = []
147143 purls = []
148144 counter = 0
@@ -161,14 +157,11 @@ def mine_and_publish_swift_packageurls(logger):
161157 path = SWIFT_CHECKPOINT_PATH ,
162158 )
163159
164- commit_changes (
165- repo = cloned_data_repo ,
166- files_to_commit = purl_files ,
167- purls = purls ,
168- mine_type = "packageURL" ,
169- tool_name = "pkg:pypi/minecode-pipelines" ,
170- tool_version = VERSION ,
171- )
160+ if purls and purl_files :
161+ commit_and_push_changes (
162+ repo = cloned_data_repo ,
163+ files_to_commit = purl_files ,
164+ purls = purls ,
165+ )
172166
173- push_changes (repo = cloned_data_repo )
174167 return [swift_index_repo , cloned_data_repo , cloned_config_repo ]
0 commit comments