repo_custom_patterns
Creates, updates, deletes, gets or lists a repo_custom_patterns resource.
Overview
| Name | repo_custom_patterns |
| Type | Resource |
| Id | github.secret_scanning.repo_custom_patterns |
Fields
The following fields are returned by SELECT queries:
- list_repo_custom_patterns
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | The ID of the custom pattern. |
name | string | The name of the custom pattern. |
created_at | string (date-time) | The date and time the custom pattern was created in ISO 8601 format. |
custom_pattern_version | string | The version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. |
end_delimiter | string | The end delimiter regex for the custom pattern. |
must_match | array | List of regexes that the secret must match. |
must_not_match | array | List of regexes that the secret must not match. |
pattern | string | The regular expression of the custom pattern. |
push_protection_enabled | boolean | Whether push protection is enabled for this custom pattern. |
slug | string | A URL-friendly identifier for the custom pattern, derived from its name. |
start_delimiter | string | The start delimiter regex for the custom pattern. |
state | string | The state of the custom pattern. (published, unpublished) |
updated_at | string (date-time) | The date and time the custom pattern was last updated in ISO 8601 format. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_repo_custom_patterns | select | owner, repo | state, push_protection, sort, direction, page, per_page | Lists secret scanning custom patterns for a repository. OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead. |
bulk_create_repo_custom_patterns | insert | owner, repo, patterns | Bulk creates secret scanning custom patterns for a repository. OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead. | |
update_repo_custom_pattern | update | owner, repo, pattern_id, custom_pattern_version, pattern, start_delimiter, end_delimiter, must_match, must_not_match | Updates a secret scanning custom pattern for a repository. OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead. | |
bulk_delete_repo_custom_patterns | delete | owner, repo | Bulk deletes secret scanning custom patterns for a repository. OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead. |
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 |
|---|---|---|
owner | string | The account owner of the repository. The name is not case sensitive. |
pattern_id | integer | The ID of the custom pattern. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
direction | string | The direction to sort the results by. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
push_protection | string | Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status. |
sort | string | The property to sort the results by. |
state | string | Filter custom patterns by state. When absent, returns patterns in all states. |
SELECT examples
- list_repo_custom_patterns
Lists secret scanning custom patterns for a repository.
OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.
SELECT
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at
FROM github.secret_scanning.repo_custom_patterns
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND state = '{{ state }}'
AND push_protection = '{{ push_protection }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- bulk_create_repo_custom_patterns
- Manifest
Bulk creates secret scanning custom patterns for a repository.
OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.
INSERT INTO github.secret_scanning.repo_custom_patterns (
patterns,
owner,
repo
)
SELECT
'{{ patterns }}' /* required */,
'{{ owner }}',
'{{ repo }}'
RETURNING
created_patterns
;
# Description fields are for documentation purposes
- name: repo_custom_patterns
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the repo_custom_patterns resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the repo_custom_patterns resource.
- name: patterns
description: |
The list of custom patterns to create.
value:
- name: "{{ name }}"
pattern: "{{ pattern }}"
start_delimiter: "{{ start_delimiter }}"
end_delimiter: "{{ end_delimiter }}"
must_match: "{{ must_match }}"
must_not_match: "{{ must_not_match }}"
UPDATE examples
- update_repo_custom_pattern
Updates a secret scanning custom pattern for a repository.
OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.
UPDATE github.secret_scanning.repo_custom_patterns
SET
pattern = '{{ pattern }}',
start_delimiter = '{{ start_delimiter }}',
end_delimiter = '{{ end_delimiter }}',
must_match = '{{ must_match }}',
must_not_match = '{{ must_not_match }}',
custom_pattern_version = '{{ custom_pattern_version }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND pattern_id = '{{ pattern_id }}' --required
AND custom_pattern_version = '{{ custom_pattern_version }}' --required
AND pattern = '{{ pattern }}' --required
AND start_delimiter = '{{ start_delimiter }}' --required
AND end_delimiter = '{{ end_delimiter }}' --required
AND must_match = '{{ must_match }}' --required
AND must_not_match = '{{ must_not_match }}' --required
RETURNING
id,
name,
created_at,
custom_pattern_version,
end_delimiter,
must_match,
must_not_match,
pattern,
push_protection_enabled,
slug,
start_delimiter,
state,
updated_at;
DELETE examples
- bulk_delete_repo_custom_patterns
Bulk deletes secret scanning custom patterns for a repository.
OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.
DELETE FROM github.secret_scanning.repo_custom_patterns
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
;