pub struct ActionsHandler<'octo> { /* private fields */ }
Expand description

Handler for GitHub’s actions API.

Created with Octocrab::actions.

Implementations§

source§

impl<'octo> ActionsHandler<'octo>

source

pub async fn add_selected_repo_to_org_secret( &self, org: impl AsRef<str>, secret_name: impl AsRef<str>, repository_id: RepositoryId ) -> Result<()>

Adds a repository to an organization secret when the visibility for repository access is set to selected. The visibility is set when you create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint.

octocrab::instance()
    .actions()
    .add_selected_repo_to_org_secret("org", "secret_name", 1234u64.into())
    .await?;
source

pub async fn remove_selected_repo_from_org_secret( &self, org: impl AsRef<str>, secret_name: impl AsRef<str>, repository_id: RepositoryId ) -> Result<()>

Removes a repository from an organization secret when the visibility for repository access is set to selected. The visibility is set when you create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint.

octocrab::instance()
    .actions()
    .remove_selected_repo_from_org_secret("org", "secret_name", 1234u64.into())
    .await?;
source

pub async fn cancel_workflow_run( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, run_id: RunId ) -> Result<()>

Cancels a workflow run using its id. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint.

octocrab::instance()
    .actions()
    .cancel_workflow_run("owner", "repo", 1234u64.into())
    .await?;
source

pub async fn download_workflow_run_logs( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, run_id: RunId ) -> Result<Bytes>

Downloads and returns the raw data representing a zip of the logs from the workflow run specified by run_id.

octocrab::instance()
    .actions()
    .download_workflow_run_logs("owner", "repo", 1234u64.into())
    .await?;
source

pub async fn download_artifact( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, artifact_id: ArtifactId, archive_format: ArchiveFormat ) -> Result<Bytes>

Downloads and returns the raw data representing an artifact from a repository.

use octocrab::params::actions::ArchiveFormat;

octocrab::instance()
    .actions()
    .download_artifact("owner", "repo", 1234u64.into(), ArchiveFormat::Zip)
    .await?;
source

pub async fn delete_workflow_run_logs( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, run_id: RunId ) -> Result<()>

Deletes all logs for a workflow run. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint.

octocrab::instance()
    .actions()
    .delete_workflow_run_logs("owner", "repo", 1234u64.into())
    .await?;
source

pub async fn get_org_public_key( &self, org: impl AsRef<str> ) -> Result<PublicKey>

Get an organization’s public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint.

let org = octocrab.actions().get_org_public_key("org").await?;
source

pub fn list_workflow_run_artifacts( &self, owner: impl Into<String>, repo: impl Into<String>, run_id: RunId ) -> ListWorkflowRunArtifacts<'_>

Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

source

pub fn create_workflow_dispatch( &self, owner: impl Into<String>, repo: impl Into<String>, workflow_id: impl Into<String>, ref: impl Into<String> ) -> WorkflowDispatchBuilder<'_>

Dispatch a workflow run. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint.

octocrab.actions()
   .create_workflow_dispatch("org", "repo", "workflow.yaml", "ref")
   // optional
   .inputs(serde_json::json!({"my-key": "my-value"}))
   .send()
   .await?;
source

pub fn list_org_self_hosted_runners( &self, org: impl Into<String> ) -> ListSelfHostedRunnersBuilder<'_, '_>

List all self-hosted runners configured in an organization.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

let runners = octocrab.actions()
   .list_org_self_hosted_runners("org")
   // optional
   .name("my-runner") // filter by name
   .per_page(15)
   .page(2u32)
   .send()
   .await?;
source

pub fn create_org_jit_runner_config( &self, org: impl Into<String>, name: impl Into<String>, runner_group_id: RunnerGroupId, labels: impl Into<Vec<String>> ) -> CreateJitRunnerConfigBuilder<'_, '_>

Generates a configuration that can be passed to the runner application at startup.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

The labels member of the CreateJitRunnerConfig must have between 1 and 100 labels, inclusive.

let jit_config = octocrab
    .actions()
    .create_repo_jit_runner_config(
        "owner",
        "repo_name",
        "my_runner_name",
        2.into(),
        ["label-1".into(), "label-2".into()],
    )
    .send()
    .await?;
// jit_config.encoded_jit_config contains the base64-encoded runner configuration
source

pub async fn create_org_runner_registration_token( &self, org: impl AsRef<str> ) -> Result<SelfHostedRunnerToken>

Returns a token that you can pass to the self-hosted runner config script to register a self-hosted runner with an organization. The token expires after one hour.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

let token_resp = octocrab.actions()
   .create_org_runner_registration_token("org")
   .await?;
// token_resp.token contains the token
source

pub async fn create_org_runner_remove_token( &self, org: impl AsRef<str> ) -> Result<SelfHostedRunnerToken>

Returns a token that you can pass to the self-hosted runner config script to remove a self-hosted runner from an organization. The token expires after one hour.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

let token_resp = octocrab.actions()
   .create_org_runner_remove_token("org")
   .await?;
// token_resp.token contains the token
source

pub async fn get_org_runner( &self, org: impl AsRef<str>, runner_id: RunnerId ) -> Result<SelfHostedRunner>

Gets a specific self-hosted runner configured in an organization.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

let runner = octocrab.actions()
   .get_org_runner("org", 27.into())
   .await?;
source

pub async fn delete_org_runner( &self, org: impl AsRef<str>, runner_id: RunnerId ) -> Result<()>

Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.

You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the organization_self_hosted_runners permission to use this endpoint.

octocrab.actions()
   .delete_org_runner("org", 27.into())
   .await?;
source

pub fn list_repo_self_hosted_runners( &self, owner: impl Into<String>, repo: impl Into<String> ) -> ListSelfHostedRunnersBuilder<'_, '_>

List all self-hosted runners configured in a repository.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission for repositories to use this endpoint.

let runners = octocrab.actions()
   .list_repo_self_hosted_runners("owner", "repo")
   // optional
   .name("my-runner") // filter by name
   .per_page(15)
   .page(2u32)
   .send()
   .await?;
source

pub fn create_repo_jit_runner_config( &self, owner: impl Into<String>, repo: impl Into<String>, name: impl Into<String>, runner_group_id: RunnerGroupId, labels: impl Into<Vec<String>> ) -> CreateJitRunnerConfigBuilder<'_, '_>

Generates a configuration that can be passed to the runner application at startup.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission for repositories to use this endpoint.

The labels member of the CreateJitRunnerConfig must have between 1 and 100 labels, inclusive.

let jit_config = octocrab
    .actions()
    .create_org_jit_runner_config(
        "org",
        "my_runner_name",
        2.into(),
        ["label-1".into(), "label-2".into()],
    )
    .send()
    .await?;
// jit_config.encoded_jit_config contains the base64-encoded runner configuration
source

pub async fn create_repo_runner_registration_token( &self, owner: impl AsRef<str>, repo: impl AsRef<str> ) -> Result<SelfHostedRunnerToken>

Returns a token that you can pass to the self-hosted runner config script to register a self-hosted runner with an organization. The token expires after one hour.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission to use this endpoint.

let token_resp = octocrab.actions()
   .create_repo_runner_registration_token("owner", "repo")
   .await?;
// token_resp.token contains the token
source

pub async fn create_repo_runner_remove_token( &self, owner: impl AsRef<str>, repo: impl AsRef<str> ) -> Result<SelfHostedRunnerToken>

Returns a token that you can pass to the self-hosted runner config script to remove a self-hosted runner from an organization. The token expires after one hour.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission to use this endpoint.

let token_resp = octocrab.actions()
   .create_repo_runner_registration_token("owner", "repo")
   .await?;
// token_resp.token contains the token
source

pub async fn get_repo_runner( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, runner_id: RunnerId ) -> Result<SelfHostedRunner>

Gets a specific self-hosted runner configured in an organization.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission to use this endpoint.

let runner = octocrab.actions()
   .get_repo_runner("owner", "repo", 27.into())
   .await?;
source

pub async fn delete_repo_runner( &self, owner: impl AsRef<str>, repo: impl AsRef<str>, runner_id: RunnerId ) -> Result<()>

Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration permission to use this endpoint.

octocrab.actions()
   .delete_repo_runner("owner", "repo", 27.into())
   .await?;

Auto Trait Implementations§

§

impl<'octo> Freeze for ActionsHandler<'octo>

§

impl<'octo> !RefUnwindSafe for ActionsHandler<'octo>

§

impl<'octo> Send for ActionsHandler<'octo>

§

impl<'octo> Sync for ActionsHandler<'octo>

§

impl<'octo> Unpin for ActionsHandler<'octo>

§

impl<'octo> !UnwindSafe for ActionsHandler<'octo>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> PolicyExt for T
where T: ?Sized,

source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more