action_updater.main package

Subpackages

Submodules

action_updater.main.action module

class action_updater.main.action.GitHubAction(filename)[source]

Bases: object

Parse a GitHub action into it’s sections.

We always present the changes (copy of original) and then can easily compare the two. The overall structure should not change.

diff(code_theme='vim')[source]

Show diff between original (cfg) and changed!

property has_changes

Determine if before != after (the action has changed)

property jobs
render_after()[source]

Render the action post-detect (with changes).

render_before()[source]

Render the action pre-detect (without changes).

property runs
property steps
write(path, line_length=None)[source]

Save the action to file.

action_updater.main.client module

class action_updater.main.client.ActionUpdater(quiet=False, token=None, settings_file=None, **kwargs)[source]

Bases: object

Create a GitHub updater

detect(paths, details=True, updaters=None)[source]

Look for changes in files according to updaters

iter_paths(paths)[source]

Helper function to flexibly handle parsing paths.

update(paths, details=True, updaters=None)[source]

Update files.

property updaters

Get a list of updaters available

action_updater.main.github module

action_updater.main.github.sort_major(tags)[source]

Allow major tags like v3

action_updater.main.github.sort_tags(tags)[source]

Sort a list of string tags, return sorted (first latest) with original version

action_updater.main.schemas module

action_updater.main.settings module

action_updater.main.settings.OrderedList(*listing)[source]

Preserve ordering when saved to yaml

class action_updater.main.settings.Settings(settings_file, validate=True)[source]

Bases: SettingsBase

The settings class is a wrapper for easily parsing a settings.yml file.

We parse into a query-able class. It also gives us control to update settings, meaning we change the values and then write them to file. It’s basically a dictionary-like class with extra functions.

class action_updater.main.settings.SettingsBase[source]

Bases: object

add(key, value)[source]

Add a value to a list parameter

change_validate(key, value)[source]

A courtesy function to validate a new config addition.

delete(key)[source]
edit(settings_file=None)[source]

Interactively edit a config (or other) file.

ensure_filesystem_registry()[source]

Ensure that the settings has a filesystem registry.

property filesystem_registry

Return the first found filesystem registry

get(key, default=None)[source]

Get a settings value, doing appropriate substitution and expansion.

get_settings_file(settings_file=None)[source]

Get the preferred user settings file, set user settings if exists.

inituser()[source]

Create a user specific config in user’s home.

load(settings_file=None)[source]

Load the settings file into the settings object

parse_boolean(value)[source]

If the value is True/False, ensure we return a boolean

parse_null(value)[source]

Given a null or none from the command line, ensure parsed as None type

remove(key, value)[source]

Remove a value from a list parameter

save(filename=None)[source]

Save settings, but do not change order of anything.

set(key, value)[source]

Set a setting based on key and value. If the key has :, it’s nested

update_param(command, param)[source]

Given a parameter, update the configuration on the fly if it’s in set/add/remove

update_params(params)[source]

Update a configuration on the fly (no save) only for set/add/remove. Unlike the traditional set/get/add functions, this function expects each entry in the params list to start with the action, e.g.:

set:name:value add:name:value rm:name:value

validate()[source]

Validate the loaded settings with jsonschema

action_updater.main.updater module

class action_updater.main.updater.UpdaterBase(token, settings=None)[source]

Bases: object

property classpath
date_time_format = '%Y-%m-%dT%H:%M:%S%z'
description = 'An abstract base updater.'
abstract detect(*args, **kwargs)[source]
get_releases(repo)[source]

Get the lateset release of an action (under flux-framework)

get_request(url)[source]

Perform a GitHub get request (assume pagination)

get_tags(repo)[source]

Get the lateset tags for a repository

get_tags_lookup(repo)[source]

This isn’t required to be sploot out, but it’s easier to debug / read if necessary

name = 'updater'
property settings

Get settings specific to updater

property slug
static_files = False
property title
update_token(token=None)[source]

Set token and headers, if found

validate_settings(settings)[source]

If settings are provided (and the updater has a schema) ensure we validate.

class action_updater.main.updater.UpdaterFinder[source]

Bases: Mapping

Create a cache of available updaters.

load()[source]

Load new updaters

Module contents

action_updater.main.get_client(quiet=False, **kwargs)[source]

Get an actions updater client.

This will ensure we add all of the default updaters to our client.