Skip to main content

autolinks

Creates, updates, deletes, gets or lists an autolinks resource.

Overview

Nameautolinks
TypeResource
Idgithub.repos.autolinks

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
is_alphanumericbooleanWhether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters.
key_prefixstringThe prefix of a key that is linkified. (example: TICKET-)
updated_atstring (date-time)
url_templatestringA template for the target URL that is generated if a key was found. (example: https://example.com/TICKET?query=<num>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_autolinkselectowner, repo, autolink_idThis returns a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.
list_autolinksselectowner, repoGets all autolinks that are configured for a repository.

Information about autolinks are only available to repository administrators.
create_autolinkinsertowner, repo, key_prefix, url_templateUsers with admin access to the repository can create an autolink.
delete_autolinkdeleteowner, repo, autolink_idThis deletes a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

This returns a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.

SELECT
id,
is_alphanumeric,
key_prefix,
updated_at,
url_template
FROM github.repos.autolinks
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND autolink_id = '{{ autolink_id }}' -- required
;

INSERT examples

Users with admin access to the repository can create an autolink.

INSERT INTO github.repos.autolinks (
key_prefix,
url_template,
is_alphanumeric,
owner,
repo
)
SELECT
'{{ key_prefix }}' /* required */,
'{{ url_template }}' /* required */,
{{ is_alphanumeric }},
'{{ owner }}',
'{{ repo }}'
RETURNING
id,
is_alphanumeric,
key_prefix,
updated_at,
url_template
;

DELETE examples

This deletes a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.

DELETE FROM github.repos.autolinks
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND autolink_id = '{{ autolink_id }}' --required
;