Get Source from GitHub Repository
  • 14 May 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

Get Source from GitHub Repository

  • Dark
    Light
  • PDF

Article Summary

This is generated from the built in components of BuildMaster 7.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.

Get Source from GitHub Repository

Gets the source code from a GitHub repository.

Script usage:

GitHub::Get-Source(
	[From: <text>],
	[UserName: <text>],
	[Password: <SecureString>],
	[Organization: <text>],
	[Repository: <text>],
	[ApiUrl: <text>],
	[DiskPath: <text>],
	[Branch: <text>],
	[Ref: <text>],
	[CommitHash: <text>],
	[PreserveLastModified: <true/false>],
	[KeepInternals: <true/false>],
	[GitExePath: <text>],
	[RecurseSubmodules: <true/false>],
	[WorkspaceDiskPath: <text>],
	[CleanWorkspace: <true/false>]
);

Arguments:

NameFormatScript UsageUsage Notes
From GitHub resource (default)
text
From
User name
text
UserName
Password
SecureString
Password
Organization name
text
Organization
Repository name
text
Repository
API URL
text
ApiUrl
Use URL from Github resource.
Export to directory
text
DiskPath
Branch name
text
Branch
Reference
text
Ref
A reference such as a tag name or a commit hash.
Commit hash
text
CommitHash
The full SHA1 hash of the fetched commit will be stored in this variable.
Preserve Last Modified Date
true/false
PreserveLastModified
By default, Git will not set the Last Modified date of files when checking out. Selecting this option may take additional time, depending on the number of files in the repository.
Copy internal Git files
true/false
KeepInternals
When exporting the repository, also export .git* files.
Git executable path
text
GitExePath
Recurse submodules
true/false
RecurseSubmodules
Workspace disk path
text
WorkspaceDiskPath
If not set, a workspace name will be automatically generated and persisted based on the Repository URL or other host-specific information (e.g. GitHub's repository name).
Clean workspace
true/false
CleanWorkspace
If set to true, the workspace directory will be cleared before any Git-based operations are performed.

Example:

# pulls source from a GitHub resource and archives/exports the contents to the $WorkingDirectory
GitHub::Get-Source MyGitHubResource;

# pulls source from a GitHub resource (with an overridden repository) and archives/exports the contents to a target directory
GitHub::Get-Source MyGitHubResource
(
    Repository: app-$ApplicationName,
    DiskPath: ~\Sources
);

Was this article helpful?