Use this data source to retrieve information about a GitHub release asset.
Example Usage
To retrieve a specific release asset from a repository based on its ID:
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getReleaseAsset({
repository: "example-repository",
owner: "example-owner",
assetId: 12345,
});
import pulumi
import pulumi_github as github
example = github.get_release_asset(repository="example-repository",
owner="example-owner",
asset_id=12345)
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.LookupReleaseAsset(ctx, &github.LookupReleaseAssetArgs{
Repository: "example-repository",
Owner: "example-owner",
AssetId: 12345,
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = Github.GetReleaseAsset.Invoke(new()
{
Repository = "example-repository",
Owner = "example-owner",
AssetId = 12345,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetReleaseAssetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = GithubFunctions.getReleaseAsset(GetReleaseAssetArgs.builder()
.repository("example-repository")
.owner("example-owner")
.assetId(12345)
.build());
}
}
variables:
example:
fn::invoke:
function: github:getReleaseAsset
arguments:
repository: example-repository
owner: example-owner
assetId: 12345
To retrieve a specific release asset from a repository, and download the file
into a file attribute on the data source:
Example coming soon!
Example coming soon!
Example coming soon!
Example coming soon!
Example coming soon!
variables:
example:
fn::invoke:
function: github:getReleaseAsset
arguments:
repository: example-repository
owner: example-owner
assetId: 12345
downloadFile: true
To retrieve the first release asset associated with the latest release in a repository:
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getRelease({
repository: "example-repository",
owner: "example-owner",
retrieveBy: "latest",
});
const exampleGetReleaseAsset = example.then(example => github.getReleaseAsset({
repository: "example-repository",
owner: "example-owner",
assetId: example.assets?.[0]?.id,
}));
import pulumi
import pulumi_github as github
example = github.get_release(repository="example-repository",
owner="example-owner",
retrieve_by="latest")
example_get_release_asset = github.get_release_asset(repository="example-repository",
owner="example-owner",
asset_id=example.assets[0].id)
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := github.LookupRelease(ctx, &github.LookupReleaseArgs{
Repository: "example-repository",
Owner: "example-owner",
RetrieveBy: "latest",
}, nil)
if err != nil {
return err
}
_, err = github.LookupReleaseAsset(ctx, &github.LookupReleaseAssetArgs{
Repository: "example-repository",
Owner: "example-owner",
AssetId: example.Assets[0].Id,
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = Github.GetRelease.Invoke(new()
{
Repository = "example-repository",
Owner = "example-owner",
RetrieveBy = "latest",
});
var exampleGetReleaseAsset = Github.GetReleaseAsset.Invoke(new()
{
Repository = "example-repository",
Owner = "example-owner",
AssetId = example.Apply(getReleaseResult => getReleaseResult.Assets[0]?.Id),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetReleaseArgs;
import com.pulumi.github.inputs.GetReleaseAssetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = GithubFunctions.getRelease(GetReleaseArgs.builder()
.repository("example-repository")
.owner("example-owner")
.retrieveBy("latest")
.build());
final var exampleGetReleaseAsset = GithubFunctions.getReleaseAsset(GetReleaseAssetArgs.builder()
.repository("example-repository")
.owner("example-owner")
.assetId(example.assets()[0].id())
.build());
}
}
variables:
example:
fn::invoke:
function: github:getRelease
arguments:
repository: example-repository
owner: example-owner
retrieveBy: latest
exampleGetReleaseAsset:
fn::invoke:
function: github:getReleaseAsset
arguments:
repository: example-repository
owner: example-owner
assetId: ${example.assets[0].id}
To retrieve all release assets associated with the the latest release in a repository:
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getRelease({
repository: "example-repository",
owner: "example-owner",
retrieveBy: "latest",
});
const exampleGetReleaseAsset = .map(__index => (github.getReleaseAsset({
repository: "example-repository",
owner: "example-owner",
assetId: _arg0_.assets[__index].id,
})));
import pulumi
import pulumi_github as github
example = github.get_release(repository="example-repository",
owner="example-owner",
retrieve_by="latest")
example_get_release_asset = [github.get_release_asset(repository="example-repository",
owner="example-owner",
asset_id=example.assets[__index].id) for __index in len(example.assets).apply(lambda length: range(length))]
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = Github.GetRelease.Invoke(new()
{
Repository = "example-repository",
Owner = "example-owner",
RetrieveBy = "latest",
});
var exampleGetReleaseAsset = ;
});
Example coming soon!
Example coming soon!
Using getReleaseAsset
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getReleaseAsset(args: GetReleaseAssetArgs, opts?: InvokeOptions): Promise<GetReleaseAssetResult>
function getReleaseAssetOutput(args: GetReleaseAssetOutputArgs, opts?: InvokeOptions): Output<GetReleaseAssetResult>def get_release_asset(asset_id: Optional[int] = None,
download_file_contents: Optional[bool] = None,
owner: Optional[str] = None,
repository: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetReleaseAssetResult
def get_release_asset_output(asset_id: Optional[pulumi.Input[int]] = None,
download_file_contents: Optional[pulumi.Input[bool]] = None,
owner: Optional[pulumi.Input[str]] = None,
repository: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetReleaseAssetResult]func LookupReleaseAsset(ctx *Context, args *LookupReleaseAssetArgs, opts ...InvokeOption) (*LookupReleaseAssetResult, error)
func LookupReleaseAssetOutput(ctx *Context, args *LookupReleaseAssetOutputArgs, opts ...InvokeOption) LookupReleaseAssetResultOutput> Note: This function is named LookupReleaseAsset in the Go SDK.
public static class GetReleaseAsset
{
public static Task<GetReleaseAssetResult> InvokeAsync(GetReleaseAssetArgs args, InvokeOptions? opts = null)
public static Output<GetReleaseAssetResult> Invoke(GetReleaseAssetInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetReleaseAssetResult> getReleaseAsset(GetReleaseAssetArgs args, InvokeOptions options)
public static Output<GetReleaseAssetResult> getReleaseAsset(GetReleaseAssetArgs args, InvokeOptions options)
fn::invoke:
function: github:index/getReleaseAsset:getReleaseAsset
arguments:
# arguments dictionaryThe following arguments are supported:
- Asset
Id int - ID of the release asset to retrieve
- Owner string
- Owner of the repository
- Repository string
- Name of the repository to retrieve the release from
- Download
File boolContents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
- Asset
Id int - ID of the release asset to retrieve
- Owner string
- Owner of the repository
- Repository string
- Name of the repository to retrieve the release from
- Download
File boolContents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
- asset
Id Integer - ID of the release asset to retrieve
- owner String
- Owner of the repository
- repository String
- Name of the repository to retrieve the release from
- download
File BooleanContents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
- asset
Id number - ID of the release asset to retrieve
- owner string
- Owner of the repository
- repository string
- Name of the repository to retrieve the release from
- download
File booleanContents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
- asset_
id int - ID of the release asset to retrieve
- owner str
- Owner of the repository
- repository str
- Name of the repository to retrieve the release from
- download_
file_ boolcontents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
- asset
Id Number - ID of the release asset to retrieve
- owner String
- Owner of the repository
- repository String
- Name of the repository to retrieve the release from
- download
File BooleanContents - Whether to download the asset file content into the
file_contentsattribute (defaults tofalse)
getReleaseAsset Result
The following output properties are available:
- Asset
Id int - Browser
Download stringUrl - Browser URL from which the release asset can be downloaded
- Content
Type string - MIME type of the asset
- Created
At string - Date the asset was created
- File
Contents string - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - Id string
- The provider-assigned unique ID for this managed resource.
- Label string
- Label for the asset
- Name string
- The file name of the asset
- Node
Id string - Node ID of the asset
- Owner string
- Repository string
- Size int
- Asset size in bytes
- Updated
At string - Date the asset was last updated
- Url string
- URL of the asset
- Download
File boolContents
- Asset
Id int - Browser
Download stringUrl - Browser URL from which the release asset can be downloaded
- Content
Type string - MIME type of the asset
- Created
At string - Date the asset was created
- File
Contents string - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - Id string
- The provider-assigned unique ID for this managed resource.
- Label string
- Label for the asset
- Name string
- The file name of the asset
- Node
Id string - Node ID of the asset
- Owner string
- Repository string
- Size int
- Asset size in bytes
- Updated
At string - Date the asset was last updated
- Url string
- URL of the asset
- Download
File boolContents
- asset
Id Integer - browser
Download StringUrl - Browser URL from which the release asset can be downloaded
- content
Type String - MIME type of the asset
- created
At String - Date the asset was created
- file
Contents String - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - id String
- The provider-assigned unique ID for this managed resource.
- label String
- Label for the asset
- name String
- The file name of the asset
- node
Id String - Node ID of the asset
- owner String
- repository String
- size Integer
- Asset size in bytes
- updated
At String - Date the asset was last updated
- url String
- URL of the asset
- download
File BooleanContents
- asset
Id number - browser
Download stringUrl - Browser URL from which the release asset can be downloaded
- content
Type string - MIME type of the asset
- created
At string - Date the asset was created
- file
Contents string - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - id string
- The provider-assigned unique ID for this managed resource.
- label string
- Label for the asset
- name string
- The file name of the asset
- node
Id string - Node ID of the asset
- owner string
- repository string
- size number
- Asset size in bytes
- updated
At string - Date the asset was last updated
- url string
- URL of the asset
- download
File booleanContents
- asset_
id int - browser_
download_ strurl - Browser URL from which the release asset can be downloaded
- content_
type str - MIME type of the asset
- created_
at str - Date the asset was created
- file_
contents str - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - id str
- The provider-assigned unique ID for this managed resource.
- label str
- Label for the asset
- name str
- The file name of the asset
- node_
id str - Node ID of the asset
- owner str
- repository str
- size int
- Asset size in bytes
- updated_
at str - Date the asset was last updated
- url str
- URL of the asset
- download_
file_ boolcontents
- asset
Id Number - browser
Download StringUrl - Browser URL from which the release asset can be downloaded
- content
Type String - MIME type of the asset
- created
At String - Date the asset was created
- file
Contents String - The base64-encoded release asset file contents (requires
download_file_contentsto betrue) - id String
- The provider-assigned unique ID for this managed resource.
- label String
- Label for the asset
- name String
- The file name of the asset
- node
Id String - Node ID of the asset
- owner String
- repository String
- size Number
- Asset size in bytes
- updated
At String - Date the asset was last updated
- url String
- URL of the asset
- download
File BooleanContents
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
githubTerraform Provider.
