Skip to content

Don't exit during a dry run?Β #14

@jean

Description

@jean

I'm using labels in an unorthodox way: I'm driving it from another package.
Specifically, I'm spreading out updates over groups of repositories:

    for repo in open(Path(group) / 'repos.txt').readlines():
        repo = repo.strip()
        workfile = Path(group) / 'workdir' / f'{repo}.toml'
        context.invoke(labels_cli.fetch_cmd, owner='...', repo=repo, filename=workfile)
        merge_labels(Path(group) / 'labels_to_update.toml', workfile)
        delete_labels(Path(group) / 'labels_to_delete.txt', workfile)
        # This may fail with labels that really require merging:
        context.invoke(labels_cli.sync_cmd, owner='...', repo=repo, filename=workfile, dryrun=dryrun)
    if not dryrun:
        rename_standard_labels(Path(group) / 'labels_to_update.toml')

This stops after the first iteration due to this line.

  • Would it be OK to just turn that into a return?
  • The reason why I'm invoking commands is that a lot of work is done in the *_cmd implementations, specifically sync_cmd. Maybe it's worthwhile moving this out to labels/commands.py or someplace, to make labels more amenable to use as library. Does this make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or enhancement for labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions