Resolve the commit message push rule chain enforced on pushes to a repository
const url = 'https://gitea.example.com/api/v1/repos/example/example/push_rules/effective';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://gitea.example.com/api/v1/repos/example/example/push_rules/effective \ --header 'Authorization: Basic <credentials>'Gitea Enterprise only. This endpoint is not part of the community edition.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Owner of the repo
Name of the repo
Responses
Section titled “Responses”EffectivePushRuleList
EffectivePushRule represents the single rule of a chain that actually applies, together with the scope it was defined on.
object
PushRule represents the push rule owned by a scope. A rule only ever describes what a scope owns itself; the effective rule enforced on a push is resolved separately, see EffectivePushRule.
object
Head branch name for new agent runs when the default name fails a branch name check; {agent} is replaced by the agent name and {issue} by the issue number or “work”
Checks agents may skip: commit_message, branch_name, author_email, file_name, file_size. They cover branches an agent run creates and commits the agent authored, pushed by its run or merged from a pull request it opened
RE2 expression the author email of every new commit must match
RE2 expression the name of a newly created branch must match; the default branch is always allowed
RE2 expression the commit message must not match
Whether the expressions are matched against the full commit message instead of only its title
Type: string default PushRuleKindDefault mandatory PushRuleKindMandatory
Most new commits one push or merge may bring in while the commit checks run; 0 for no limit
Largest file in MiB a new commit may add or modify; 0 for no limit
Mode is always custom for the global scope and for a mandatory rule; the default rule of an organization or a repository may also be inherit, copy or none type: string inherit PushRuleModeInherit copy PushRuleModeCopy custom PushRuleModeCustom none PushRuleModeNone
RE2 expression no file path added or modified by a new commit may match
RE2 expression the commit message must match
Type: string global PushRuleScopeGlobal org PushRuleScopeOrg repo PushRuleScopeRepo
ID of the organization or repository that owns the rule; 0 for the global scope
The scope the rule content was copied from, set only when mode is copy type: string global PushRuleScopeGlobal org PushRuleScopeOrg repo PushRuleScopeRepo
Increments on every save of this rule
Type: string global PushRuleScopeGlobal org PushRuleScopeOrg repo PushRuleScopeRepo
Example
[ { "rule": { "kind": "default", "mode": "inherit", "scope": "global", "source": "global" }, "source": "global" }]APINotFound is a not found empty response