ghapi 2.1.4__tar.gz → 2.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {ghapi-2.1.4/ghapi.egg-info → ghapi-2.1.5}/PKG-INFO +3 -2
  2. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/__init__.py +1 -1
  3. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/_modidx.py +3 -6
  4. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/core.py +35 -9
  5. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/gh_spec.py +204 -13
  6. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/gql_spec.py +17 -17
  7. ghapi-2.1.5/ghapi/skill.py +75 -0
  8. {ghapi-2.1.4 → ghapi-2.1.5/ghapi.egg-info}/PKG-INFO +3 -2
  9. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi.egg-info/requires.txt +1 -0
  10. {ghapi-2.1.4 → ghapi-2.1.5}/pyproject.toml +3 -3
  11. ghapi-2.1.4/ghapi/skill.py +0 -80
  12. {ghapi-2.1.4 → ghapi-2.1.5}/CONTRIBUTING.md +0 -0
  13. {ghapi-2.1.4 → ghapi-2.1.5}/LICENSE +0 -0
  14. {ghapi-2.1.4 → ghapi-2.1.5}/MANIFEST.in +0 -0
  15. {ghapi-2.1.4 → ghapi-2.1.5}/README.md +0 -0
  16. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/actions.py +0 -0
  17. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/all.py +0 -0
  18. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/auth.py +0 -0
  19. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/build_lib.py +0 -0
  20. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/cli.py +0 -0
  21. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/event.py +0 -0
  22. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/graphql.py +0 -0
  23. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/page.py +0 -0
  24. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/py.typed +0 -0
  25. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi/templates.py +0 -0
  26. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi.egg-info/SOURCES.txt +0 -0
  27. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi.egg-info/dependency_links.txt +0 -0
  28. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi.egg-info/entry_points.txt +0 -0
  29. {ghapi-2.1.4 → ghapi-2.1.5}/ghapi.egg-info/top_level.txt +0 -0
  30. {ghapi-2.1.4 → ghapi-2.1.5}/setup.cfg +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghapi
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: A python client for the GitHub API
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/fastai/ghapi
8
8
  Project-URL: Documentation, https://ghapi.fast.ai/
9
9
  Keywords: github,api
@@ -28,6 +28,7 @@ Requires-Dist: pyyaml; extra == "dev"
28
28
  Requires-Dist: pysym2md>=0.0.6; extra == "dev"
29
29
  Requires-Dist: llms-txt>=0.0.6; extra == "dev"
30
30
  Requires-Dist: pyskills>=0.0.30; extra == "dev"
31
+ Requires-Dist: pycachy>=0.0.21; extra == "dev"
31
32
  Dynamic: license-file
32
33
 
33
34
  # ghapi
@@ -5,4 +5,4 @@ Modules:
5
5
  - `ghapi.graphql`: Query GitHub's GraphQL API with schema-aware chaining, batched requests and raw GraphQL
6
6
  - `ghapi.skill`: GitHub REST and GraphQL access, plus local git operations. Read before working with GitHub issues, PRs, CI, releases, branches, or gists, and before repo-local git operations."""
7
7
 
8
- __version__ = "2.1.4"
8
+ __version__ = "2.1.5"
@@ -22,7 +22,6 @@ d = { 'settings': { 'branch': 'main',
22
22
  'ghapi.actions.github_token': ('actions.html#github_token', 'ghapi/actions.py'),
23
23
  'ghapi.actions.set_git_user': ('actions.html#set_git_user', 'ghapi/actions.py'),
24
24
  'ghapi.actions.user_repo': ('actions.html#user_repo', 'ghapi/actions.py')},
25
- 'ghapi.all': {},
26
25
  'ghapi.auth': { 'ghapi.auth.GhDeviceAuth': ('auth.html#ghdeviceauth', 'ghapi/auth.py'),
27
26
  'ghapi.auth.GhDeviceAuth.__init__': ('auth.html#ghdeviceauth.__init__', 'ghapi/auth.py'),
28
27
  'ghapi.auth.GhDeviceAuth._getattr': ('auth.html#ghdeviceauth._getattr', 'ghapi/auth.py'),
@@ -91,6 +90,7 @@ d = { 'settings': { 'branch': 'main',
91
90
  'ghapi.core._dur': ('core.html#_dur', 'ghapi/core.py'),
92
91
  'ghapi.core._filter_diff': ('core.html#_filter_diff', 'ghapi/core.py'),
93
92
  'ghapi.core._fmt_replies': ('core.html#_fmt_replies', 'ghapi/core.py'),
93
+ 'ghapi.core._fold_groups': ('core.html#_fold_groups', 'ghapi/core.py'),
94
94
  'ghapi.core._include': ('core.html#_include', 'ghapi/core.py'),
95
95
  'ghapi.core._listed': ('core.html#_listed', 'ghapi/core.py'),
96
96
  'ghapi.core._load_tmpl': ('core.html#_load_tmpl', 'ghapi/core.py'),
@@ -99,6 +99,7 @@ d = { 'settings': { 'branch': 'main',
99
99
  'ghapi.core._pr_mark': ('core.html#_pr_mark', 'ghapi/core.py'),
100
100
  'ghapi.core._reduce_ctx': ('core.html#_reduce_ctx', 'ghapi/core.py'),
101
101
  'ghapi.core._run_subp': ('core.html#_run_subp', 'ghapi/core.py'),
102
+ 'ghapi.core._step_lines': ('core.html#_step_lines', 'ghapi/core.py'),
102
103
  'ghapi.core._transdeps': ('core.html#_transdeps', 'ghapi/core.py'),
103
104
  'ghapi.core.call_gh': ('core.html#call_gh', 'ghapi/core.py'),
104
105
  'ghapi.core.check_status': ('core.html#check_status', 'ghapi/core.py'),
@@ -153,8 +154,6 @@ d = { 'settings': { 'branch': 'main',
153
154
  'ghapi.event._want_evt': ('event.html#_want_evt', 'ghapi/event.py'),
154
155
  'ghapi.event.load_sample_events': ('event.html#load_sample_events', 'ghapi/event.py'),
155
156
  'ghapi.event.save_sample_events': ('event.html#save_sample_events', 'ghapi/event.py')},
156
- 'ghapi.gh_spec': {},
157
- 'ghapi.gql_spec': {},
158
157
  'ghapi.graphql': { 'ghapi.graphql.GhGql': ('graphql.html#ghgql', 'ghapi/graphql.py'),
159
158
  'ghapi.graphql.GhGql.__init__': ('graphql.html#ghgql.__init__', 'ghapi/graphql.py'),
160
159
  'ghapi.graphql.GhGql.repo': ('graphql.html#ghgql.repo', 'ghapi/graphql.py')},
@@ -175,6 +174,4 @@ d = { 'settings': { 'branch': 'main',
175
174
  'ghapi.page.pages': ('page.html#pages', 'ghapi/page.py'),
176
175
  'ghapi.page.parse_link_hdr': ('page.html#parse_link_hdr', 'ghapi/page.py'),
177
176
  'ghapi.page.sync_paged': ('page.html#sync_paged', 'ghapi/page.py'),
178
- 'ghapi.page.sync_pages': ('page.html#sync_pages', 'ghapi/page.py')},
179
- 'ghapi.skill': {},
180
- 'ghapi.templates': {}}}
177
+ 'ghapi.page.sync_pages': ('page.html#sync_pages', 'ghapi/page.py')}}}
@@ -232,9 +232,7 @@ async def create_gist(self:GhApi, description, content, filename='gist.txt', pub
232
232
  @patch
233
233
  def load_gist(self:GhApi, gist_id:str):
234
234
  "Retrieve a gist by id, or by `user/id` (as it appears in gist URLs); coro if async client"
235
- if '/' in gist_id: *_,user,gist_id = gist_id.split('/')
236
- else: user = None
237
- return self.gists.get(gist_id, user=user)
235
+ return self.gists.get(gist_id.split('/')[-1])
238
236
 
239
237
  @patch
240
238
  def gist_file(self:GhApi, gist_id:str):
@@ -420,9 +418,10 @@ async def enable_pages(self:GhApi, branch=None, path="/"):
420
418
  r = await self.repos.get()
421
419
  branch = branch or r.default_branch
422
420
  source = {"branch": branch, "path": path}
423
- if r.has_pages: return # await self.repos.update_information_about_pages_site(source=source)
424
421
  if len(await self.list_branches(branch))==0: await self.create_branch_empty(branch)
425
- return await self.repos.create_pages_site(source=source)
422
+ if not r.has_pages: return await self.repos.create_pages_site(source=source)
423
+ await self.repos.update_information_about_pages_site(source=source)
424
+ return await self.repos.get_pages()
426
425
 
427
426
  # %% ../nbs/00_core.ipynb #519ec71c
428
427
  class _IssueInfo(AttrDict):
@@ -647,20 +646,47 @@ async def pr_status(self:GhApi, pull_number:int):
647
646
  "Combined status and check-run results for a PR's head commit"
648
647
  return await self.check_status((await self.pulls.get(pull_number)).head.sha)
649
648
 
649
+ # %% ../nbs/00_core.ipynb #40f5c88a
650
+ def _step_lines(zf, job, s):
651
+ "Timestamped log lines for step `s` of `job`. They come from the step's own archive file, or else from the job's combined log, cut to the step's time window and its last `##[error]` line."
652
+ names = zf.namelist()
653
+ if name := first(n for n in names if n.startswith(f'{job.name}/{s.number}_')): return zf.read(name).decode().splitlines()
654
+ name = first(n for n in names if re.fullmatch(rf'\d+_{re.escape(job.name)}\.txt', n))
655
+ lines = [l for l in zf.read(name).decode('utf-8-sig').splitlines() if s.started_at[:19] <= l[:19] <= s.completed_at[:19]]
656
+ last = max((i for i,l in enumerate(lines) if l.split(' ', 1)[-1].startswith('##[error]')), default=len(lines)-1)
657
+ return lines[:last+1]
658
+
659
+ # %% ../nbs/00_core.ipynb #fd5e2942
660
+ def _fold_groups(lines, n=20):
661
+ "Fold each finished `##[group]` of more than `n` lines, unless it holds an error or warning. An unfinished group stays whole, since the step died inside it."
662
+ res, start = [], None
663
+ for l in lines:
664
+ res.append(l)
665
+ if l.startswith('##[group]'): start = len(res)
666
+ elif l.startswith('##[endgroup]') and start is not None:
667
+ body = res[start:-1]
668
+ if len(body) > n and not any(o.startswith(('##[error]', '##[warning]')) for o in body): res[start:-1] = [f'… {len(body)} lines folded']
669
+ start = None
670
+ return res
671
+
650
672
  # %% ../nbs/00_core.ipynb #569864f5
651
673
  @gh_patch
652
- async def failed_step_log(self:GhApi, job_id:int):
674
+ async def failed_step_log(
675
+ self:GhApi,
676
+ job_id:int, # Workflow job id, which is also its check run id
677
+ fold:bool=True, # Fold long finished `##[group]` blocks that hold no error or warning?
678
+ ):
653
679
  """Return the failed steps' log sections, each headed by its step name.
654
680
 
655
- An Actions check run's id is its job id. Pass that id from `check_status` or `pr_status`. The returned text's display is truncated at 8,000 characters. GitHub can expire or delete stored logs.
681
+ An Actions check run's id is its job id. Pass that id from `check_status` or `pr_status`. The returned text's display is truncated at 8,000 characters. Long finished `##[group]` blocks with no error or warning are folded to a line count. GitHub can expire or delete stored logs.
656
682
  """
657
683
  job = await self.actions.get_job_for_workflow_run(job_id=job_id)
658
684
  zf = zipfile.ZipFile(io.BytesIO(await self.actions.download_workflow_run_logs(run_id=job.run_id)))
659
685
  res = []
660
686
  for s in job.steps:
661
687
  if s.conclusion!='failure': continue
662
- name = first(n for n in zf.namelist() if n.startswith(f'{job.name}/{s.number}_'))
663
- lines = [strip_ansi(l.split(' ', 1)[-1]) for l in zf.read(name).decode().splitlines()]
688
+ lines = [strip_ansi(l.split(' ', 1)[-1]) for l in _step_lines(zf, job, s)]
689
+ if fold: lines = _fold_groups(lines)
664
690
  res.append(f'# {s.name}\n' + '\n'.join(lines))
665
691
  return TruncatedString('\n\n'.join(res), 8_000)
666
692
 
@@ -737,7 +737,7 @@ spec = {'base_url': 'https://api.github.com',
737
737
  'API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
738
738
  'after': 'A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see "[Using pagination in the REST '
739
739
  'API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
740
- 'status': 'A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`'},
740
+ 'status': 'A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`, `enterprise_enforced`'},
741
741
  'docs_url': 'https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-an-enterprise-code-security-configuration'},
742
742
  {'group': 'copilot',
743
743
  'name': 'copilot_enterprise_one_day_usage_metrics',
@@ -2463,6 +2463,76 @@ spec = {'base_url': 'https://api.github.com',
2463
2463
  'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'default_workflow_permissions': 'The default workflow permissions granted to the GITHUB_TOKEN when running workflows.', 'can_approve_pull_request_reviews': 'Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.'},
2464
2464
  'body_examples': {'default': {'summary': 'Give read-only permission, and allow approving PRs.', 'value': {'default_workflow_permissions': 'read', 'can_approve_pull_request_reviews': True}}},
2465
2465
  'docs_url': 'https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization'},
2466
+ {'group': 'actions',
2467
+ 'name': 'get_org_actions_policies',
2468
+ 'path': '/orgs/{org}/actions/policies',
2469
+ 'verb': 'GET',
2470
+ 'summary': 'List organization Actions policies',
2471
+ 'route_params': ['org'],
2472
+ 'query_params': ['per_page', 'page', 'has_parents'],
2473
+ 'required_params': ['org'],
2474
+ 'param_types': {'org': 'str', 'per_page': 'int', 'page': 'int', 'has_parents': 'bool'},
2475
+ 'param_defaults': {'per_page': 30, 'page': 1, 'has_parents': True},
2476
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.',
2477
+ 'per_page': 'The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
2478
+ 'page': 'The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
2479
+ 'has_parents': 'Include policies configured at higher levels that apply to this organization'},
2480
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#list-organization-actions-policies'},
2481
+ {'group': 'actions',
2482
+ 'name': 'create_org_actions_policy',
2483
+ 'path': '/orgs/{org}/actions/policies',
2484
+ 'verb': 'POST',
2485
+ 'summary': 'Create an organization Actions policy',
2486
+ 'route_params': ['org'],
2487
+ 'body_params': ['name', 'enforcement', 'conditions', 'rules'],
2488
+ 'request_content_type': 'application/json',
2489
+ 'required_params': ['enforcement', 'name', 'org'],
2490
+ 'param_types': {'org': 'str', 'name': 'str', 'enforcement': 'str', 'conditions': 'dict', 'rules': 'list'},
2491
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.',
2492
+ 'name': 'The name of the policy.',
2493
+ 'enforcement': 'The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).',
2494
+ 'conditions': 'Conditions for an organization Actions policy. The conditions object should contain one of `repository_name`, `repository_id`, or `repository_property`, and may also contain `workflow_path`.',
2495
+ 'rules': 'An array of rules within the policy.'},
2496
+ 'body_examples': {'default': {'summary': '', 'value': {'name': 'Require approved actors', 'enforcement': 'active', 'rules': [{'type': 'restrict_actions_actors', 'parameters': {'allowed_actors': [{'id': 1234, 'type': 'Team'}]}}]}}},
2497
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#create-an-organization-actions-policy'},
2498
+ {'group': 'actions',
2499
+ 'name': 'get_org_actions_policy',
2500
+ 'path': '/orgs/{org}/actions/policies/{policy_id}',
2501
+ 'verb': 'GET',
2502
+ 'summary': 'Get an organization Actions policy',
2503
+ 'route_params': ['org', 'policy_id'],
2504
+ 'required_params': ['org', 'policy_id'],
2505
+ 'param_types': {'org': 'str', 'policy_id': 'int'},
2506
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'policy_id': 'The ID of the policy.'},
2507
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#get-an-organization-actions-policy'},
2508
+ {'group': 'actions',
2509
+ 'name': 'update_org_actions_policy',
2510
+ 'path': '/orgs/{org}/actions/policies/{policy_id}',
2511
+ 'verb': 'PUT',
2512
+ 'summary': 'Update an organization Actions policy',
2513
+ 'route_params': ['org', 'policy_id'],
2514
+ 'body_params': ['name', 'enforcement', 'conditions', 'rules'],
2515
+ 'request_content_type': 'application/json',
2516
+ 'required_params': ['org', 'policy_id'],
2517
+ 'param_types': {'org': 'str', 'policy_id': 'int', 'name': 'str', 'enforcement': 'str', 'conditions': 'dict', 'rules': 'list'},
2518
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.',
2519
+ 'policy_id': 'The ID of the policy.',
2520
+ 'name': 'The name of the policy.',
2521
+ 'enforcement': 'The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).',
2522
+ 'conditions': 'Conditions for an organization Actions policy. The conditions object should contain one of `repository_name`, `repository_id`, or `repository_property`, and may also contain `workflow_path`.',
2523
+ 'rules': 'An array of rules within the policy.'},
2524
+ 'body_examples': {'default': {'summary': '', 'value': {'name': 'Updated policy name', 'enforcement': 'active'}}},
2525
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#update-an-organization-actions-policy'},
2526
+ {'group': 'actions',
2527
+ 'name': 'delete_org_actions_policy',
2528
+ 'path': '/orgs/{org}/actions/policies/{policy_id}',
2529
+ 'verb': 'DELETE',
2530
+ 'summary': 'Delete an organization Actions policy',
2531
+ 'route_params': ['org', 'policy_id'],
2532
+ 'required_params': ['org', 'policy_id'],
2533
+ 'param_types': {'org': 'str', 'policy_id': 'int'},
2534
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'policy_id': 'The ID of the policy.'},
2535
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#delete-an-organization-actions-policy'},
2466
2536
  {'group': 'actions',
2467
2537
  'name': 'list_self_hosted_runner_groups_for_org',
2468
2538
  'path': '/orgs/{org}/actions/runner-groups',
@@ -3607,6 +3677,30 @@ spec = {'base_url': 'https://api.github.com',
3607
3677
  'param_types': {'org': 'str', 'campaign_number': 'int'},
3608
3678
  'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'campaign_number': 'The campaign number.'},
3609
3679
  'docs_url': 'https://docs.github.com/rest/campaigns/campaigns#delete-a-campaign-for-an-organization'},
3680
+ {'group': 'code_scanning',
3681
+ 'name': 'get_ai_scan_enablement_for_org',
3682
+ 'path': '/orgs/{org}/code-scanning/ai-scan',
3683
+ 'verb': 'GET',
3684
+ 'summary': 'Get the AI Scan setting for an organization',
3685
+ 'route_params': ['org'],
3686
+ 'required_params': ['org'],
3687
+ 'param_types': {'org': 'str'},
3688
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.'},
3689
+ 'docs_url': 'https://docs.github.com/rest/code-scanning/code-scanning#get-the-ai-scan-setting-for-an-organization'},
3690
+ {'group': 'code_scanning',
3691
+ 'name': 'update_ai_scan_enablement_for_org',
3692
+ 'path': '/orgs/{org}/code-scanning/ai-scan',
3693
+ 'verb': 'PATCH',
3694
+ 'summary': 'Update the AI Scan setting for an organization',
3695
+ 'route_params': ['org'],
3696
+ 'body_params': ['pr_scan'],
3697
+ 'request_content_type': 'application/json',
3698
+ 'required_params': ['org'],
3699
+ 'param_types': {'org': 'str', 'pr_scan': 'str'},
3700
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.',
3701
+ 'pr_scan': 'Whether AI Scan is enabled for the organization. Organization respects enterprise policy. Disabled organizations prevent repositories from enabling AI Scan. Enabled organizations enable AI Scan for their repositories, but individual repositories can opt out.'},
3702
+ 'body_examples': {'default': {'summary': '', 'value': {'pr_scan': 'enabled'}}},
3703
+ 'docs_url': 'https://docs.github.com/rest/code-scanning/code-scanning#update-the-ai-scan-setting-for-an-organization'},
3610
3704
  {'group': 'code_scanning',
3611
3705
  'name': 'list_alerts_for_org',
3612
3706
  'path': '/orgs/{org}/code-scanning/alerts',
@@ -3940,7 +4034,7 @@ spec = {'base_url': 'https://api.github.com',
3940
4034
  'API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
3941
4035
  'after': 'A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see "[Using pagination in the REST '
3942
4036
  'API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
3943
- 'status': 'A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `detached`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`'},
4037
+ 'status': 'A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `detached`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`, `enterprise_enforced`'},
3944
4038
  'docs_url': 'https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration'},
3945
4039
  {'group': 'codespaces',
3946
4040
  'name': 'list_in_organization',
@@ -5148,12 +5242,12 @@ spec = {'base_url': 'https://api.github.com',
5148
5242
  'verb': 'PATCH',
5149
5243
  'summary': 'Update pull request creation cap for an org',
5150
5244
  'route_params': ['org'],
5151
- 'body_params': ['enabled', 'max_open_pull_requests'],
5245
+ 'body_params': ['enabled', 'max_open_pull_requests', 'include_drafts'],
5152
5246
  'request_content_type': 'application/json',
5153
5247
  'required_params': ['enabled', 'org'],
5154
- 'param_types': {'org': 'str', 'enabled': 'bool', 'max_open_pull_requests': 'int'},
5155
- 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'enabled': 'Whether the pull request creation cap is enabled', 'max_open_pull_requests': 'The maximum number of open pull requests a user can have at one time'},
5156
- 'body_examples': {'default': {'summary': 'Example request body', 'value': {'enabled': True, 'max_open_pull_requests': 1}}},
5248
+ 'param_types': {'org': 'str', 'enabled': 'bool', 'max_open_pull_requests': 'int', 'include_drafts': 'bool'},
5249
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'enabled': 'Whether the pull request creation cap is enabled', 'max_open_pull_requests': 'The maximum number of open pull requests a user can have at one time', 'include_drafts': 'Whether draft pull requests count toward the pull request creation cap'},
5250
+ 'body_examples': {'default': {'summary': 'Example request body', 'value': {'enabled': True, 'max_open_pull_requests': 1, 'include_drafts': True}}},
5157
5251
  'docs_url': 'https://docs.github.com/rest/interactions/orgs#update-pull-request-creation-cap-for-an-org'},
5158
5252
  {'group': 'orgs',
5159
5253
  'name': 'list_pending_invitations',
@@ -6898,7 +6992,7 @@ spec = {'base_url': 'https://api.github.com',
6898
6992
  'request_content_type': 'application/json',
6899
6993
  'required_params': ['org', 'patterns'],
6900
6994
  'param_types': {'org': 'str', 'patterns': 'list'},
6901
- 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'patterns': 'The list of custom patterns to create.'},
6995
+ 'param_docs': {'org': 'The organization name. The name is not case sensitive.', 'patterns': 'The list of custom patterns to create (maximum 100).'},
6902
6996
  'body_examples': {'default': {'summary': '', 'value': {'patterns': [{'name': 'Example Custom Pattern', 'pattern': '[a-z]+_token_[0-9]+'}, {'name': 'Another Custom Pattern', 'pattern': 'prefix_[a-zA-Z0-9]{32}', 'start_delimiter': '\\b', 'end_delimiter': '\\b', 'must_match': ['^prefix_prod'], 'must_not_match': ['test']}]}}},
6903
6997
  'docs_url': 'https://docs.github.com/rest/secret-scanning/custom-patterns#bulk-create-organization-custom-patterns'},
6904
6998
  {'group': 'secret_scanning',
@@ -7992,6 +8086,79 @@ spec = {'base_url': 'https://api.github.com',
7992
8086
  'can_approve_pull_request_reviews': 'Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.'},
7993
8087
  'body_examples': {'default': {'summary': 'Give read-only permission, and allow approving PRs.', 'value': {'default_workflow_permissions': 'read', 'can_approve_pull_request_reviews': True}}},
7994
8088
  'docs_url': 'https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository'},
8089
+ {'group': 'actions',
8090
+ 'name': 'get_repo_actions_policies',
8091
+ 'path': '/repos/{owner}/{repo}/actions/policies',
8092
+ 'verb': 'GET',
8093
+ 'summary': 'List repository Actions policies',
8094
+ 'route_params': ['owner', 'repo'],
8095
+ 'query_params': ['per_page', 'page', 'has_parents'],
8096
+ 'required_params': ['owner', 'repo'],
8097
+ 'param_types': {'owner': 'str', 'repo': 'str', 'per_page': 'int', 'page': 'int', 'has_parents': 'bool'},
8098
+ 'param_defaults': {'per_page': 30, 'page': 1, 'has_parents': True},
8099
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.',
8100
+ 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.',
8101
+ 'per_page': 'The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
8102
+ 'page': 'The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."',
8103
+ 'has_parents': 'Include policies configured at higher levels that apply to this repository'},
8104
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#list-repository-actions-policies'},
8105
+ {'group': 'actions',
8106
+ 'name': 'create_repo_actions_policy',
8107
+ 'path': '/repos/{owner}/{repo}/actions/policies',
8108
+ 'verb': 'POST',
8109
+ 'summary': 'Create a repository Actions policy',
8110
+ 'route_params': ['owner', 'repo'],
8111
+ 'body_params': ['name', 'enforcement', 'conditions', 'rules'],
8112
+ 'request_content_type': 'application/json',
8113
+ 'required_params': ['enforcement', 'name', 'owner', 'repo'],
8114
+ 'param_types': {'owner': 'str', 'repo': 'str', 'name': 'str', 'enforcement': 'str', 'conditions': 'dict', 'rules': 'list'},
8115
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.',
8116
+ 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.',
8117
+ 'name': 'The name of the policy.',
8118
+ 'enforcement': 'The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).',
8119
+ 'conditions': 'Conditions for a repository Actions policy. The object may be empty to preserve or use the default workflow targeting, or contain only `workflow_path`.',
8120
+ 'rules': 'An array of rules within the policy.'},
8121
+ 'body_examples': {'default': {'summary': '', 'value': {'name': 'Require approved actors', 'enforcement': 'active', 'rules': [{'type': 'restrict_actions_actors', 'parameters': {'allowed_actors': [{'id': 1234, 'type': 'Team'}]}}]}}},
8122
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#create-a-repository-actions-policy'},
8123
+ {'group': 'actions',
8124
+ 'name': 'get_repo_actions_policy',
8125
+ 'path': '/repos/{owner}/{repo}/actions/policies/{policy_id}',
8126
+ 'verb': 'GET',
8127
+ 'summary': 'Get a repository Actions policy',
8128
+ 'route_params': ['owner', 'repo', 'policy_id'],
8129
+ 'required_params': ['owner', 'policy_id', 'repo'],
8130
+ 'param_types': {'owner': 'str', 'repo': 'str', 'policy_id': 'int'},
8131
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.', 'policy_id': 'The ID of the policy.'},
8132
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#get-a-repository-actions-policy'},
8133
+ {'group': 'actions',
8134
+ 'name': 'update_repo_actions_policy',
8135
+ 'path': '/repos/{owner}/{repo}/actions/policies/{policy_id}',
8136
+ 'verb': 'PUT',
8137
+ 'summary': 'Update a repository Actions policy',
8138
+ 'route_params': ['owner', 'repo', 'policy_id'],
8139
+ 'body_params': ['name', 'enforcement', 'conditions', 'rules'],
8140
+ 'request_content_type': 'application/json',
8141
+ 'required_params': ['owner', 'policy_id', 'repo'],
8142
+ 'param_types': {'owner': 'str', 'repo': 'str', 'policy_id': 'int', 'name': 'str', 'enforcement': 'str', 'conditions': 'dict', 'rules': 'list'},
8143
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.',
8144
+ 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.',
8145
+ 'policy_id': 'The ID of the policy.',
8146
+ 'name': 'The name of the policy.',
8147
+ 'enforcement': 'The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).',
8148
+ 'conditions': 'Conditions for a repository Actions policy. The object may be empty to preserve or use the default workflow targeting, or contain only `workflow_path`.',
8149
+ 'rules': 'An array of rules within the policy.'},
8150
+ 'body_examples': {'default': {'summary': '', 'value': {'name': 'Updated policy name', 'enforcement': 'active'}}},
8151
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#update-a-repository-actions-policy'},
8152
+ {'group': 'actions',
8153
+ 'name': 'delete_repo_actions_policy',
8154
+ 'path': '/repos/{owner}/{repo}/actions/policies/{policy_id}',
8155
+ 'verb': 'DELETE',
8156
+ 'summary': 'Delete a repository Actions policy',
8157
+ 'route_params': ['owner', 'repo', 'policy_id'],
8158
+ 'required_params': ['owner', 'policy_id', 'repo'],
8159
+ 'param_types': {'owner': 'str', 'repo': 'str', 'policy_id': 'int'},
8160
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.', 'policy_id': 'The ID of the policy.'},
8161
+ 'docs_url': 'https://docs.github.com/rest/actions/policies#delete-a-repository-actions-policy'},
7995
8162
  {'group': 'actions',
7996
8163
  'name': 'list_self_hosted_runners_for_repo',
7997
8164
  'path': '/repos/{owner}/{repo}/actions/runners',
@@ -9788,6 +9955,29 @@ spec = {'base_url': 'https://api.github.com',
9788
9955
  'ai_findings_option': 'Whether AI findings run for Code Quality on this repository.'},
9789
9956
  'body_examples': {'default': {'summary': '', 'value': {'state': 'configured', 'languages': ['javascript-typescript', 'python', 'ruby']}}},
9790
9957
  'docs_url': 'https://docs.github.com/rest/code-quality/code-quality#update-a-code-quality-setup-configuration'},
9958
+ {'group': 'code_scanning',
9959
+ 'name': 'get_ai_scan_enablement',
9960
+ 'path': '/repos/{owner}/{repo}/code-scanning/ai-scan',
9961
+ 'verb': 'GET',
9962
+ 'summary': 'Get AI Scan enablement for a repository',
9963
+ 'route_params': ['owner', 'repo'],
9964
+ 'required_params': ['owner', 'repo'],
9965
+ 'param_types': {'owner': 'str', 'repo': 'str'},
9966
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.'},
9967
+ 'docs_url': 'https://docs.github.com/rest/code-scanning/code-scanning#get-ai-scan-enablement-for-a-repository'},
9968
+ {'group': 'code_scanning',
9969
+ 'name': 'update_ai_scan_enablement',
9970
+ 'path': '/repos/{owner}/{repo}/code-scanning/ai-scan',
9971
+ 'verb': 'PATCH',
9972
+ 'summary': 'Update AI Scan enablement for a repository',
9973
+ 'route_params': ['owner', 'repo'],
9974
+ 'body_params': ['pr_scan'],
9975
+ 'request_content_type': 'application/json',
9976
+ 'required_params': ['owner', 'repo'],
9977
+ 'param_types': {'owner': 'str', 'repo': 'str', 'pr_scan': 'str'},
9978
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.', 'pr_scan': 'Whether to enable or disable AI Scan for the repository.'},
9979
+ 'body_examples': {'default': {'summary': 'Enable AI Scan', 'value': {'pr_scan': 'enabled'}}},
9980
+ 'docs_url': 'https://docs.github.com/rest/code-scanning/code-scanning#update-ai-scan-enablement-for-a-repository'},
9791
9981
  {'group': 'code_scanning',
9792
9982
  'name': 'list_alerts_for_repo',
9793
9983
  'path': '/repos/{owner}/{repo}/code-scanning/alerts',
@@ -10319,7 +10509,7 @@ spec = {'base_url': 'https://api.github.com',
10319
10509
  'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.',
10320
10510
  'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.',
10321
10511
  'username': 'The handle for the GitHub user account.',
10322
- 'permission': 'The permission to grant the collaborator. **Only valid on organization-owned repositories.** We accept the following permissions to be set: `pull`, `triage`, `push`, `maintain`, `admin` and you can also specify a custom repository role name, if the owning organization has defined any.'},
10512
+ 'permission': 'The permission to grant the collaborator. **Only valid on organization-owned repositories.** We accept the following permissions to be set: `pull`, `triage`, `triage_plus`, `push`, `maintain`, `admin` and you can also specify a custom repository role name, if the owning organization has defined any.'},
10323
10513
  'body_examples': {'new-invitation-is-created': {'summary': 'Add a collaborator with triage permissions', 'value': {'permission': 'triage'}}},
10324
10514
  'docs_url': 'https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator'},
10325
10515
  {'group': 'repos',
@@ -12047,15 +12237,16 @@ spec = {'base_url': 'https://api.github.com',
12047
12237
  'verb': 'PATCH',
12048
12238
  'summary': 'Update pull request creation cap for a repository',
12049
12239
  'route_params': ['owner', 'repo'],
12050
- 'body_params': ['enabled', 'max_open_pull_requests'],
12240
+ 'body_params': ['enabled', 'max_open_pull_requests', 'include_drafts'],
12051
12241
  'request_content_type': 'application/json',
12052
12242
  'required_params': ['enabled', 'owner', 'repo'],
12053
- 'param_types': {'owner': 'str', 'repo': 'str', 'enabled': 'bool', 'max_open_pull_requests': 'int'},
12243
+ 'param_types': {'owner': 'str', 'repo': 'str', 'enabled': 'bool', 'max_open_pull_requests': 'int', 'include_drafts': 'bool'},
12054
12244
  'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.',
12055
12245
  'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.',
12056
12246
  'enabled': 'Whether the pull request creation cap is enabled',
12057
- 'max_open_pull_requests': 'The maximum number of open pull requests a user can have at one time'},
12058
- 'body_examples': {'default': {'summary': 'Example request body', 'value': {'enabled': True, 'max_open_pull_requests': 1}}},
12247
+ 'max_open_pull_requests': 'The maximum number of open pull requests a user can have at one time',
12248
+ 'include_drafts': 'Whether draft pull requests count toward the pull request creation cap'},
12249
+ 'body_examples': {'default': {'summary': 'Example request body', 'value': {'enabled': True, 'max_open_pull_requests': 1, 'include_drafts': True}}},
12059
12250
  'docs_url': 'https://docs.github.com/rest/interactions/repos#update-pull-request-creation-cap-for-a-repository'},
12060
12251
  {'group': 'repos',
12061
12252
  'name': 'list_invitations',
@@ -14409,7 +14600,7 @@ spec = {'base_url': 'https://api.github.com',
14409
14600
  'request_content_type': 'application/json',
14410
14601
  'required_params': ['owner', 'patterns', 'repo'],
14411
14602
  'param_types': {'owner': 'str', 'repo': 'str', 'patterns': 'list'},
14412
- 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.', 'patterns': 'The list of custom patterns to create.'},
14603
+ 'param_docs': {'owner': 'The account owner of the repository. The name is not case sensitive.', 'repo': 'The name of the repository without the `.git` extension. The name is not case sensitive.', 'patterns': 'The list of custom patterns to create (maximum 100).'},
14413
14604
  'body_examples': {'default': {'summary': '', 'value': {'patterns': [{'name': 'Example Custom Pattern', 'pattern': '[a-z]+_token_[0-9]+'}, {'name': 'Another Custom Pattern', 'pattern': 'prefix_[a-zA-Z0-9]{32}', 'start_delimiter': '\\b', 'end_delimiter': '\\b', 'must_match': ['^prefix_prod'], 'must_not_match': ['test']}]}}},
14414
14605
  'docs_url': 'https://docs.github.com/rest/secret-scanning/custom-patterns#bulk-create-repository-custom-patterns'},
14415
14606
  {'group': 'secret_scanning',