github.wit

 1interface github {
 2    /// A GitHub release.
 3    record github-release {
 4        /// The version of the release.
 5        version: string,
 6        /// The list of assets attached to the release.
 7        assets: list<github-release-asset>,
 8    }
 9
10    /// An asset from a GitHub release.
11    record github-release-asset {
12        /// The name of the asset.
13        name: string,
14        /// The download URL for the asset.
15        download-url: string,
16        /// The SHA-256 of the release asset if provided by the GitHub API.
17        digest: option<string>,
18    }
19
20    /// The options used to filter down GitHub releases.
21    record github-release-options {
22        /// Whether releases without assets should be included.
23        require-assets: bool,
24        /// Whether pre-releases should be included.
25        pre-release: bool,
26    }
27
28    /// Returns the latest release for the given GitHub repository.
29    ///
30    /// Takes repo as a string in the form "<owner-name>/<repo-name>", for example: "zed-industries/zed".
31    latest-github-release: func(repo: string, options: github-release-options) -> result<github-release, string>;
32
33    /// Returns the GitHub release with the specified tag name for the given GitHub repository.
34    ///
35    /// Returns an error if a release with the given tag name does not exist.
36    github-release-by-tag-name: func(repo: string, tag: string) -> result<github-release, string>;
37}