OPRF Asset Updater

GitHub Action

The most common usage of this module is through the OPRF Asset Updater GitHub action. Documentation can be found in marketplace listing or the repository readme.

CLI Usage

A script which automatically updates OPRF standard asset files from the OpRedFlag repository

usage: oprf update [-h] [-d DIRECTORY] [-r REPOSITORY] [-b BRANCH]
                   [-v VERSION_JSON] [-i INCLUDE] [-e EXCLUDE]
                   [-c {major,minor,patch,none}] [-s]
                   [-u UPDATE_TIMESTAMP_AFTER]

Named Arguments

-d, --directory

Local root directory

Default: '.'

-r, --repository

Location of OpRedFlag asset GitHub repository, in User/Repo format. Default: “Op-RedFlag/OpRedFlag”

Default: 'Op-Redflag/OpRedFlag'

-b, --branch

The branch of the OpRedFlag repository to use. Default: “master”

Default: 'master'

-v, --version-json

Location of local versions.json file. Default: “oprf-versions.json”

Default: 'oprf-versions.json'

-i, --include

Files to update, separated by commas. Default: “*”

Default: '*'

-e, --exclude

Files to skip, separated by commas. Default: “”

Default: ''

-c, --compatibility

Possible choices: major, minor, patch, none

Compatibility level, will only allow updates of this level or lower. Default: “minor”

Default: minor

-s, --strict

Fail if local file versions are newer than remote

Default: False

-u, --update-timestamp-after

Update the timestamp in the version file if this many days has passed. 0 for always and -1 for never. Default: 30

Default: 30

Code Reference

class opredflag.updater.Updater(directory='.', version_json='oprf-versions.json', repository='Op-Redflag/OpRedFlag', branch='master', include='*', exclude='', compatibility=Compatibility.MINOR, strict=False, update_timestamp_after=30)[source]

The base updater class which handles the whole process.

Parameters:
  • directory (str) – Local root directory

  • version_json (str) – Location of local versions.json file

  • repository (str) – Location of OpRedFlag asset GitHub repository, in User/Repo format

  • branch (str) – The branch of the repository to use

  • include (str) – Files to update, separated by commas

  • exclude (str) – Files to skip, separated by commas

  • compatibility (Compatibility) – Compatibility level, will only allow updates of this level or lower

  • strict (bool) – Fail if local file versions are newer than remote

  • update_timestamp_after (int) –

    Automatically update the last_updated key in the version file after this amount of days,

    even when no changes have been made. Set to 0 for always or -1 for never.

await run()[source]

Run the update.

Returns:

The script output, split by newlines

Return type:

list[str]

class opredflag.updater.Compatibility[source]

Represents a compatibility level between semantic versions.

MAJOR

Compatibility with any major version, least strict.

MINOR

Compatibility with any minor version with the same major version, less strict.

PATCH

Compatibility with any patch version with the same major and minor version, most strict.