This is part of the Fake.Api.GitHub module.

GitHub

Contains tasks to interact with GitHub releases

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
   Target.create "GitHubRelease" (fun _ ->
       let token =
           match Environment.environVarOrDefault "github_token" "" with
           | s when not (System.String.IsNullOrWhiteSpace s) -> s
           | _ -> failwith "please set the github_token environment variable to a github personal access token with repro access."

       let files =
           runtimes @ [ "portable"; "packages" ]
           |> List.map (fun n -> sprintf "release/dotnetcore/Fake.netcore/fake-dotnetcore-%s.zip" n)

       GitHub.createClientWithToken token
       |> GitHub.draftNewRelease gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes
       |> GitHub.uploadFiles files
       |> GitHub.publishDraft
       |> Async.RunSynchronously)
val not : value:bool -> bool
namespace System
Multiple items
type String =
  new : value:char[] -> string + 8 overloads
  member Chars : int -> char
  member Clone : unit -> obj
  member CompareTo : value:obj -> int + 1 overload
  member Contains : value:string -> bool + 3 overloads
  member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
  member EndsWith : value:string -> bool + 3 overloads
  member EnumerateRunes : unit -> StringRuneEnumerator
  member Equals : obj:obj -> bool + 2 overloads
  member GetEnumerator : unit -> CharEnumerator
  ...

--------------------
System.String(value: char []) : System.String
System.String(value: nativeptr<char>) : System.String
System.String(value: nativeptr<sbyte>) : System.String
System.String(value: System.ReadOnlySpan<char>) : System.String
System.String(c: char, count: int) : System.String
System.String(value: char [], startIndex: int, length: int) : System.String
System.String(value: nativeptr<char>, startIndex: int, length: int) : System.String
System.String(value: nativeptr<sbyte>, startIndex: int, length: int) : System.String
System.String(value: nativeptr<sbyte>, startIndex: int, length: int, enc: System.Text.Encoding) : System.String
System.String.IsNullOrWhiteSpace(value: string) : bool
val failwith : message:string -> 'T
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
    interface IReadOnlyList<'T>
    interface IReadOnlyCollection<'T>
    interface IEnumerable
    interface IEnumerable<'T>
    member GetSlice : startIndex:int option * endIndex:int option -> 'T list
    member Head : 'T
    member IsEmpty : bool
    member Item : index:int -> 'T with get
    member Length : int
    member Tail : 'T list
    ...
val map : mapping:('T -> 'U) -> list:'T list -> 'U list
val sprintf : format:Printf.StringFormat<'T> -> 'T
union case Option.None: Option<'T>
Multiple items
type Async =
  static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
  static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
  static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
  static member AwaitTask : task:Task -> Async<unit>
  static member AwaitTask : task:Task<'T> -> Async<'T>
  static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
  static member CancelDefaultToken : unit -> unit
  static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
  static member Choice : computations:seq<Async<'T option>> -> Async<'T option>
  static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
  ...

--------------------
type Async<'T> =
static member Async.RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:System.Threading.CancellationToken -> 'T

Nested types and modules

TypeDescription
CreateReleaseParams
Release

Functions and values

Function or valueDescription
GitHub.createClient user password
Signature: user:string -> password:string -> Async<GitHubClient>

Creates a GitHub API v3 client using the specified credentials

GitHub.createClientWithToken(token)
Signature: token:string -> Async<GitHubClient>

Creates a GitHub API v3 client using the specified token

GitHub.createGHEClient url user password
Signature: url:string -> user:string -> password:string -> Async<GitHubClient>

Creates a GitHub API v3 client to GitHub Enterprise server at the specified url using the specified credentials

GitHub.createGHEClientWithToken(...)
Signature: url:string -> token:string -> Async<GitHubClient>

Creates a GitHub API v3 client to GitHub Enterprise server at the specified url using the specified token

GitHub.createRelease(...)
Signature: owner:string -> repoName:string -> tagName:string -> setParams:(CreateReleaseParams -> CreateReleaseParams) -> client:Async<GitHubClient> -> Async<Release>

Creates a GitHub Release for the specified repository and tag name

Parameters

  • owner - the repository's owner
  • repoName - the repository's name
  • tagName - the name of the tag to use for this release
  • setParams - function used to override the default release parameters
  • client - GitHub API v3 client
GitHub.downloadAsset(...)
Signature: id:int -> destination:string -> release:Async<Release> -> Async<unit>

Downloads the asset with the specified id to the specified destination

GitHub.downloadAssets(...)
Signature: destination:string -> release:Async<Release> -> Async<unit>

Downloads all assets for the specified release to the specified destination

GitHub.draftNewRelease(...)
Signature: owner:string -> repoName:string -> tagName:string -> prerelease:bool -> notes:seq<string> -> client:Async<GitHubClient> -> Async<Release>

Creates a draft GitHub Release for the specified repository and tag name

Parameters

  • owner - the repository's owner
  • repoName - the repository's name
  • tagName - the name of the tag to use for this release
  • prerelease - indicates whether the release will be created as a prerelease
  • notes - collection of release notes that will be inserted into the body of the release
  • client - GitHub API v3 client
GitHub.getLastRelease(...)
Signature: owner:string -> repoName:string -> client:Async<GitHubClient> -> Async<Release>

Gets the latest release for the specified repository

GitHub.getReleaseByTag(...)
Signature: owner:string -> repoName:string -> tagName:string -> client:Async<GitHubClient> -> Async<Release>

Gets release with the specified tag for the specified repository

GitHub.publishDraft(release)
Signature: release:Async<Release> -> Async<unit>

Publishes the specified release by removing its draft status

GitHub.uploadFile fileName release
Signature: fileName:string -> release:Async<Release> -> Async<Release>

Uploads and attaches the specified file to the specified release

GitHub.uploadFiles fileNames release
Signature: fileNames:seq<string> -> release:Async<Release> -> Async<Release>

Uploads and attaches the specified files to the specified release