GitHub API
Access the GitHub API in your templates.
GitHub ExpressionEngine Add-on
Perform various GitHub API (http://developer.github.com/v3/) functions.
Demonstrations
Introduction, Configuration, {exp:cl_github_api:repo}, and {exp:cl_github_api:repo_path_contents}
Usage
Installation
Copy /third_party/cl_github_api
into /system/expressionengine/third_party
.
Configuration
You’ll need to obtain a personal access token (for your user, not organization) here.
You can then add this to the configuration under Add-ons -> GitHub -> Global Settings
.
Tags
{exp:cl_github_api:user_repos}
Lists repositories for the specified user.
Parameters
user (required)
Repository user.
type (default:
all
)Type of repository to get.
all
,owner
, ormember
.sort (default:
full_name
)The attribute in which to sort.
created
,updated
,pushed
, orfull_name
direction (default: when using
full_name
:asc
, otherwisedesc
)Sort direction.
asc
ordesc
.var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
downloads:
would produce the variable{downloads:name}
Variables
This tag allows full access to the JSON response from the API located here.
{exp:cl_github_api:repo_contents_archive}
Outputs the repo contents archive as a full http response.
Parameters
owner (required)
Repository owner.
repo (required)
Repository to get archive from.
archive_format (default:
zipball
)Archive format to get. Either
zipball
ortarball
.ref (default:
master
)Valid Git reference (sha, tag, etc.)
{exp:cl_github_api:repo_downloads}
Lists package downloads available for a repository.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
downloads:
would produce the variable{downloads:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_tags}
Lists tags for a given repository.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
sort (default:
asc
)Sorts the tag by it’s name. Either
asc
ordesc
.limit
Limits the number of tags displayed.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_issues}
Lists issues for a given repo.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
milestone
Either milestone number,
none
or*
.state (default:
open
)Issue’s state. Either
open
orclosed
.labels
Shows only issues including one or more labels from a comma separated list of label names. i.e.
bug, enhancement
.var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_milestones}
Lists milestones for a given repo.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
state (default:
open
)Milestone’s state. Either
open
orclosed
.sort (default:
due_date
)The attribute in which to sort. Either
due_date
orcompleteness
.direction (default:
desc
)Sort direction.
asc
ordesc
reverse
Reverse the results. This is useful if issues have identical due dates or completeness. My experience shows GitHub then sorts by milestone creation date.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_issue_comments}
Lists comments for a given issue.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
issue_number (required)
Issue number.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_commit}
Returns information about a specific commit.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
sha (required)
SHA.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo_path_contents}
Get information and contents of a file or directory.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
path (required)
Path to a file or directory.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
{exp:cl_github_api:repo}
Get information about a specific repository.
Parameters
owner (required)
Repository owner.
repo (required)
Repository.
var_prefix
Allows you to prefix the variables below to prevent name collisions. i.e.
item:
would produce the variable{item:name}
encode_ee_tags
Encodes expression engine tags so they are not parsed. Either
yes
orno
.
Variables
This tag allows full access to the JSON response from the API located here as EE template tags.
Help
Change Log
v1.2.5 (Released 10-16-2013)
-
Fixed version number.
v1.2.4 (Released 10-16-2013)
-
Fixed install for 2.6 and 2.7.
v1.2.3 (Released 10-15-2013)
-
Fixed database issue with 2.5.5 where exp_modules didn't have settings column.
v1.2.2 (Released 10-15-2013)
-
Fixed ee() instance error with EE 2.5.5.
v1.2.1 (Released 10-15-2013)
-
Fixed database error due to two third_party directories.
v1.2.0 (Released 10-15-2013)
-
Renamed extension for our friends at devot-ee. Module tags are now cl_github_api.
v1.0.2 (Released 09-22-2013)
-
Documented tags.
v1.0.1 (Released 09-16-2013)
-
Get repository information.
v1.2.7 (Released 12-29-2013)
-
Implemented encode_ee_tags for all module tags.
v1.2.6 (Released 10-17-2013)
-
Fixed autoload.php error.
v1.0.0 (Released 09-10-2013)
-
Implemented repository contents method.
-
Implemented commits API.
-
Implemented issues events.
-
Implemented issue comments.
-
Implemented milestone listing.
-
Implemented issue listing.
-
Implemented get contents archive.