Retrieves the contents of a file or directory from a GitHub repository.

External Documentation

To learn more, visit the GitHub documentation.

Parameters

ParameterDescription
OwnerThe account owner of the repository. The name is not case sensitive.
PathPath to a specific file or folder within the repository. If the path isn’t specified, the action wil be directed to the repository’s root.Note: To return the content in its raw form, You Must use this parameter and specify a relative file path. Directories can’t be retrieved in their raw form.
ReferenceThe name of the commit/branch/tag (Default - the repository’s default branch (usually master).
RepoThe name of the repository. The name is not case sensitive.
Return RawSelect to return content in its raw form.Note: Supported only for files, not directories. To retrieve the raw content of a repository file, use the Path parameter and specify the relative file path.

Example Output

{
	"summary": "Response if content is a directory",
	"value": [
		{
			"_links": {
				"git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
				"html": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb",
				"self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb"
			},
			"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/lib/octokit.rb",
			"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
			"html_url": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb",
			"name": "octokit.rb",
			"path": "lib/octokit.rb",
			"sha": "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
			"size": 625,
			"type": "file",
			"url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb"
		},
		{
			"_links": {
				"git": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
				"html": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit",
				"self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit"
			},
			"download_url": null,
			"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
			"html_url": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit",
			"name": "octokit",
			"path": "lib/octokit",
			"sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
			"size": 0,
			"type": "dir",
			"url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit"
		}
	]
}

Workflow Library Example

Get Repository Content with Github and Send Results Via Email

Preview this Workflow on desktop