Struct octocrab::actions::ActionsHandler
source · pub struct ActionsHandler<'octo> { /* private fields */ }
Expand description
Handler for GitHub’s actions API.
Created with Octocrab::actions
.
Implementations§
source§impl<'octo> ActionsHandler<'octo>
impl<'octo> ActionsHandler<'octo>
sourcepub async fn add_selected_repo_to_org_secret(
&self,
org: impl AsRef<str>,
secret_name: impl AsRef<str>,
repository_id: RepositoryId
) -> Result<()>
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?;
sourcepub async fn remove_selected_repo_from_org_secret(
&self,
org: impl AsRef<str>,
secret_name: impl AsRef<str>,
repository_id: RepositoryId
) -> Result<()>
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?;
sourcepub async fn cancel_workflow_run(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
run_id: RunId
) -> Result<()>
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?;
sourcepub async fn download_workflow_run_logs(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
run_id: RunId
) -> Result<Bytes>
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?;
sourcepub async fn download_artifact(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
artifact_id: ArtifactId,
archive_format: ArchiveFormat
) -> Result<Bytes>
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?;
sourcepub async fn delete_workflow_run_logs(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
run_id: RunId
) -> Result<()>
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?;
sourcepub async fn get_org_public_key(
&self,
org: impl AsRef<str>
) -> Result<PublicKey>
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?;
sourcepub fn list_workflow_run_artifacts(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
run_id: RunId
) -> ListWorkflowRunArtifacts<'_>
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.
sourcepub fn create_workflow_dispatch(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
workflow_id: impl Into<String>,
ref: impl Into<String>
) -> WorkflowDispatchBuilder<'_>
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?;
sourcepub fn list_org_self_hosted_runners(
&self,
org: impl Into<String>
) -> ListSelfHostedRunnersBuilder<'_, '_>
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?;
sourcepub 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<'_, '_>
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
sourcepub async fn create_org_runner_registration_token(
&self,
org: impl AsRef<str>
) -> Result<SelfHostedRunnerToken>
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
sourcepub async fn create_org_runner_remove_token(
&self,
org: impl AsRef<str>
) -> Result<SelfHostedRunnerToken>
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
sourcepub async fn get_org_runner(
&self,
org: impl AsRef<str>,
runner_id: RunnerId
) -> Result<SelfHostedRunner>
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?;
sourcepub async fn delete_org_runner(
&self,
org: impl AsRef<str>,
runner_id: RunnerId
) -> Result<()>
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?;
sourcepub fn list_repo_self_hosted_runners(
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> ListSelfHostedRunnersBuilder<'_, '_>
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?;
sourcepub 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<'_, '_>
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
sourcepub async fn create_repo_runner_registration_token(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>
) -> Result<SelfHostedRunnerToken>
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
sourcepub async fn create_repo_runner_remove_token(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>
) -> Result<SelfHostedRunnerToken>
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
sourcepub async fn get_repo_runner(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
runner_id: RunnerId
) -> Result<SelfHostedRunner>
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?;
sourcepub async fn delete_repo_runner(
&self,
owner: impl AsRef<str>,
repo: impl AsRef<str>,
runner_id: RunnerId
) -> Result<()>
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?;