-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from NASA-IMPACT/269-github-pipeline-shows-0-…
…files-changed-even-with-rules-present Fix bugs in the GitHub pipeline
- Loading branch information
Showing
4 changed files
with
48 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from sde_collections.models.collection import Collection | ||
from sde_collections.utils.github_helper import GitHubHandler | ||
|
||
|
||
class Command(BaseCommand): | ||
help = ( | ||
"Push config to github. Takes comma-separated config_folder list as argument." | ||
) | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument("config_folders", nargs="*", type=str, default=[]) | ||
|
||
def handle(self, *args, **options): | ||
config_folders = options["config_folders"] | ||
|
||
# curation status 5 is Curated | ||
collections = Collection.objects.filter( | ||
config_folder__in=config_folders | ||
).filter(curation_status=5) | ||
|
||
cant_push = Collection.objects.filter(config_folder__in=config_folders).exclude( | ||
curation_status=5 | ||
) | ||
cant_push = list(cant_push.values_list("name", flat=True)) | ||
|
||
gh = GitHubHandler(collections) | ||
gh.push_to_github() | ||
|
||
self.stdout.write( | ||
self.style.SUCCESS( | ||
"Successfully pushed: %s" | ||
% list(collections.values_list("name", flat=True)) | ||
) | ||
) | ||
|
||
if cant_push: | ||
self.stdout.write( | ||
self.style.ERROR( | ||
"Can't push since status is not Curated (choice_id:5) %s" | ||
% cant_push | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters