Skip to content

GitHub Functions

🛠️ Tools · ⬅ Top


githubLatest

Get the latest JSON structure

Usage

githubLatest projectName

Get the latest JSON structure

Arguments

  • projectName - String. Required. Github project name in the form of owner/repository

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

githubLatestRelease

Get the latest release version

Usage

githubLatestRelease projectName

Get the latest release version

Arguments

  • projectName - String. Required. Github project name in the form of owner/repository

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

githubRelease

Generate a release on GitHub using API

Usage

githubRelease [ --token token ] [ --owner owner ] [ --name name ] [ --expire expire ] descriptionFilePath releaseName commitish

Use GitHub API to generate a release

GitHub MUST have two sets of credentials enabled:

  • The SSH key for the deployment robot should have push access to the repository on GitHub to enable releases (git handles this)
  • Found here: https://github.com/$repoOwner/$repoName/settings/keys
  • The token must have the permission to create releases for this repository
  • Found here: https://github.com/settings/tokens

Think of them of the "source" (user) and "target" (ssh key) access. Both must exist to work.

Arguments

  • --help - Optional. Flag. Display this help.
  • --handler handler - Optional. Function. Use this error handler instead of the default error handler.
  • --token token - Optional. Uses GITHUB_ACCESS_TOKEN if not supplied. Access token for GitHub REST API.
  • --owner owner - Optional. Uses GITHUB_REPOSITORY_OWNER if not supplied. Repository owner of release.
  • --name name - Optional. Uses GITHUB_REPOSITORY_NAME if not supplied. Repository name to release.
  • --expire expireString - Optional. Uses GITHUB_ACCESS_TOKEN_EXPIRE if not supplied. Expiration time for the token.
  • descriptionFilePath - Required. File which exists. Path to file containing release notes (typically markdown)
  • releaseName - Required. String. Name of the release (e.g. v1.0.0)
  • commitish - Required. String. The GIT short SHA tag for the release

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • GITHUB_ACCESS_TOKEN - Access to GitHub to publish releases
    • GITHUB_ACCESS_TOKEN_EXPIRE - Date in YYYY-MM-DD format which represents the date when GITHUB_ACCESS_TOKEN expires (required)
    • GITHUB_REPOSITORY_OWNER - Owner of the repository (https://github.com/owner)
    • GITHUB_REPOSITORY_NAME - Name of the repository (https://github.com/owner/name)
  • GITHUB_ACCESS_TOKEN - String. Access token used for release

githubPublishDate

Output the publish date for the latest release of ownerRepository

Usage

githubPublishDate [ ownerRepository ]

Output the publish date for the latest release of ownerRepository

Arguments

  • ownerRepository - String. Github owner/repository string

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

githubURLParse

Parse a GitHub URL and return the owner and project

Usage

githubURLParse url

Parse a GitHub URL and return the owner and project name

Arguments

  • url - URL. Required. URL to parse.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

githubProjectJSON

Get a project JSON structure

Usage

githubProjectJSON

Get a project JSON structure

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment