autolinks
Creates, updates, deletes, gets or lists an autolinks resource.
Overview
| Name | autolinks |
| Type | Resource |
| Id | github.repos.autolinks |
Fields
The following fields are returned by SELECT queries:
- get_autolink
- list_autolinks
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
is_alphanumeric | boolean | Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. |
key_prefix | string | The prefix of a key that is linkified. (example: TICKET-) |
updated_at | string (date-time) | |
url_template | string | A template for the target URL that is generated if a key was found. (example: https://example.com/TICKET?query=<num>) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
is_alphanumeric | boolean | Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. |
key_prefix | string | The prefix of a key that is linkified. (example: TICKET-) |
updated_at | string (date-time) | |
url_template | string | A 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_autolink | select | owner, repo, autolink_id | This returns a single autolink reference by ID that was configured for the given repository. Information about autolinks are only available to repository administrators. | |
list_autolinks | select | owner, repo | Gets all autolinks that are configured for a repository. Information about autolinks are only available to repository administrators. | |
create_autolink | insert | owner, repo, key_prefix, url_template | Users with admin access to the repository can create an autolink. | |
delete_autolink | delete | owner, repo, autolink_id | This 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.
| Name | Datatype | Description |
|---|---|---|
autolink_id | integer | The unique identifier of the autolink. |
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
SELECT examples
- get_autolink
- list_autolinks
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
;
Gets all autolinks that are configured for a 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
;
INSERT examples
- create_autolink
- Manifest
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
;
# Description fields are for documentation purposes
- name: autolinks
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the autolinks resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the autolinks resource.
- name: key_prefix
value: "{{ key_prefix }}"
description: |
This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.
- name: url_template
value: "{{ url_template }}"
description: |
The URL must contain `<num>` for the reference number. `<num>` matches different characters depending on the value of `is_alphanumeric`.
- name: is_alphanumeric
value: {{ is_alphanumeric }}
description: |
Whether this autolink reference matches alphanumeric characters. If true, the `<num>` parameter of the `url_template` matches alphanumeric characters `A-Z` (case insensitive), `0-9`, and `-`. If false, this autolink reference only matches numeric characters.
default: true
DELETE examples
- delete_autolink
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
;