saltext.github.utils.gh.actions¶
Operations on GitHub Actions repository secrets and settings.
- saltext.github.utils.gh.actions.list_secrets(conn, repo_name, *, owner=None)[source]¶
Return all Actions secrets of a repository. Secret values are write-only, so this only carries metadata (
name,created_at,updated_at).- conn
GitHubConnectionto use.- repo_name
Repository name.
- owner
Owner of the repository. Defaults to the connection’s owner.
- saltext.github.utils.gh.actions.get_secret(conn, repo_name, name, *, owner=None)[source]¶
Return the metadata of a single Actions secret.
- conn
GitHubConnectionto use.- repo_name
Repository name.
- name
Secret name.
- owner
Owner of the repository. Defaults to the connection’s owner.
Raises
GitHubNotFoundErrorif the secret does not exist.
- saltext.github.utils.gh.actions.get_public_key(conn, repo_name, *, owner=None)[source]¶
Return the public key used for encrypting Actions secrets of a repository, a mapping with
key_idand (base64-encoded)key.- conn
GitHubConnectionto use.- repo_name
Repository name.
- owner
Owner of the repository. Defaults to the connection’s owner.
- saltext.github.utils.gh.actions.encrypt_secret(public_key, value)[source]¶
Encrypt a secret value for upload using a repository public key (libsodium sealed box). Returns the base64-encoded ciphertext.
- public_key
Base64-encoded public key of the repository, as returned by
get_public_key()inkey.- value
Secret value to encrypt.
- saltext.github.utils.gh.actions.set_secret(conn, repo_name, name, value, *, owner=None)[source]¶
Create or update an Actions secret. The value is encrypted to the repository public key before leaving this host.
- conn
GitHubConnectionto use.- repo_name
Repository name.
- name
Secret name.
- value
Plaintext secret value.
- owner
Owner of the repository. Defaults to the connection’s owner.
- saltext.github.utils.gh.actions.delete_secret(conn, repo_name, name, *, owner=None)[source]¶
Remove an Actions secret from a repository.
- conn
GitHubConnectionto use.- repo_name
Repository name.
- name
Secret name.
- owner
Owner of the repository. Defaults to the connection’s owner.
- saltext.github.utils.gh.actions.get_workflow_permissions(conn, repo_name, *, owner=None)[source]¶
Return the default workflow permissions granted to the
GITHUB_TOKENin a repository, a mapping withdefault_workflow_permissions(read/write) andcan_approve_pull_request_reviews.- conn
GitHubConnectionto use.- repo_name
Repository name.
- owner
Owner of the repository. Defaults to the connection’s owner.
- saltext.github.utils.gh.actions.set_workflow_permissions(conn, repo_name, *, default_workflow_permissions=None, can_approve_pull_request_reviews=None, owner=None)[source]¶
Update the default workflow permissions granted to the
GITHUB_TOKENin a repository.- conn
GitHubConnectionto use.- repo_name
Repository name.
- default_workflow_permissions
Default permissions for the
GITHUB_TOKEN, eitherreadorwrite.- can_approve_pull_request_reviews
Allow GitHub Actions to approve pull requests.
- owner
Owner of the repository. Defaults to the connection’s owner.