keep-github-workflows-active 2.1.5__py3-none-any.whl → 2.3.0__py3-none-any.whl

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.
@@ -24,7 +24,7 @@ name = "keep_github_workflows_active"
24
24
  #: Human-readable summary shown in CLI help output.
25
25
  title = "Template for python apps with registered cli commands"
26
26
  #: Current release version pulled from ``pyproject.toml`` by automation.
27
- version = "2.1.5"
27
+ version = "2.3.0"
28
28
  #: Repository homepage presented to users.
29
29
  homepage = "https://github.com/bitranox/keep_github_workflows_active"
30
30
  #: Author attribution surfaced in CLI output.
@@ -30,11 +30,13 @@ class SkippedWorkflowType(IntEnum):
30
30
 
31
31
  PAGES_BUILD_DEPLOYMENT = 1
32
32
  DEPENDABOT = 2
33
+ UPDATE_GRAPH = 3
33
34
 
34
35
 
35
36
  SKIPPED_WORKFLOW_PREFIXES: dict[SkippedWorkflowType, str] = {
36
37
  SkippedWorkflowType.PAGES_BUILD_DEPLOYMENT: "pages-build-deployment",
37
38
  SkippedWorkflowType.DEPENDABOT: "dependabot",
39
+ SkippedWorkflowType.UPDATE_GRAPH: "update-graph",
38
40
  }
39
41
 
40
42
 
@@ -336,13 +338,13 @@ def _lookup_config_value(key: str) -> str:
336
338
  >>> _ = os.environ.pop("KEEP_GITHUB_WORKFLOWS_ACTIVE_DOTENV_PATH", None)
337
339
  """
338
340
 
339
- env_value = os.environ.get(key)
341
+ env_value = os.environ.get(key, "").strip()
340
342
  if env_value:
341
343
  return env_value
342
344
 
343
345
  for env_file in _candidate_env_files():
344
346
  config = _read_env_file(env_file)
345
- file_value = config.get_value(key)
347
+ file_value = (config.get_value(key) or "").strip()
346
348
  if file_value:
347
349
  return file_value
348
350
 
@@ -493,24 +495,39 @@ def get_repositories(owner: str, github_token: str) -> list[str]:
493
495
 
494
496
  """
495
497
  repositories: list[str] = []
496
- url: str | None = f"https://api.github.com/users/{owner}/repos?per_page=100"
497
498
  headers = {"Authorization": f"Bearer {github_token}", "Accept": "application/vnd.github.v3+json"}
498
499
 
500
+ # Try the org endpoint first (returns private repos too), fall back to user endpoint.
501
+ org_url = f"https://api.github.com/orgs/{owner}/repos?per_page=100"
502
+ user_url = f"https://api.github.com/users/{owner}/repos?per_page=100"
503
+ probe = requests.get(org_url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
504
+ if probe.status_code == 404:
505
+ url: str | None = user_url
506
+ probe = None # Discard the 404 so the loop fetches fresh from user endpoint.
507
+ else:
508
+ url: str | None = org_url
509
+
499
510
  while url:
500
511
  try:
501
- response = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
502
- response.raise_for_status()
512
+ # Reuse the probe response for the first org page to avoid a duplicate request.
513
+ if probe is not None:
514
+ response = probe
515
+ probe = None
516
+ response.raise_for_status()
517
+ else:
518
+ response = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
519
+ response.raise_for_status()
503
520
  parsed = GitHubRepositoriesResponse.model_validate(response.json())
504
521
  repositories.extend(repo.name for repo in parsed.repositories)
505
522
  url = _get_next_page_url(response)
506
523
 
507
524
  except requests.exceptions.HTTPError as exc:
508
525
  error = GitHubErrorResponse.from_response(exc.response)
509
- result = f"ERROR reading repositories for user {owner}: {error.message}"
526
+ result = f"ERROR reading repositories for {owner}: {error.message}"
510
527
  logger.error(sanitization.sanitize_message(result))
511
528
  raise RuntimeError(result) from exc
512
529
 
513
- result = f"Found {len(repositories)} repositories for user {owner}"
530
+ result = f"Found {len(repositories)} repositories for {owner}"
514
531
  logger.info(sanitization.sanitize_message(result))
515
532
  return repositories
516
533
 
@@ -682,6 +699,8 @@ def enable_workflow(owner: str, repository: str, workflow_filename: str, github_
682
699
  result = f"Repository {repository}, workflow {workflow_filename} skipped - those can not be enabled"
683
700
  elif skip_reason == SkippedWorkflowType.DEPENDABOT:
684
701
  result = f"Repository {repository}, workflow {workflow_filename} skipped - managed by Dependabot"
702
+ elif skip_reason == SkippedWorkflowType.UPDATE_GRAPH:
703
+ result = f"Repository {repository}, workflow {workflow_filename} skipped - managed by GitHub dependency graph"
685
704
  else:
686
705
  response = requests.put(url, headers=headers, timeout=REQUEST_TIMEOUT_SECONDS)
687
706
  response.raise_for_status()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keep_github_workflows_active
3
- Version: 2.1.5
3
+ Version: 2.3.0
4
4
  Summary: Template for python apps with registered cli commands
5
5
  Project-URL: Homepage, https://github.com/bitranox/keep_github_workflows_active
6
6
  Project-URL: Repository, https://github.com/bitranox/keep_github_workflows_active.git
@@ -17,22 +17,22 @@ Classifier: Programming Language :: Python :: 3 :: Only
17
17
  Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.10
20
- Requires-Dist: lib-cli-exit-tools>=2.3.0
21
- Requires-Dist: pydantic>=2.12.5
22
- Requires-Dist: requests>=2.33.0
20
+ Requires-Dist: lib-cli-exit-tools>=2.3.1
21
+ Requires-Dist: pydantic>=2.13.3
22
+ Requires-Dist: requests>=2.33.1
23
23
  Requires-Dist: rich-click>=1.9.7
24
24
  Provides-Extra: dev
25
25
  Requires-Dist: bandit>=1.9.4; extra == 'dev'
26
- Requires-Dist: build>=1.4.2; extra == 'dev'
27
- Requires-Dist: codecov-cli>=11.2.7; extra == 'dev'
26
+ Requires-Dist: build>=1.5.0; extra == 'dev'
27
+ Requires-Dist: codecov-cli>=11.2.8; extra == 'dev'
28
28
  Requires-Dist: import-linter>=2.11; extra == 'dev'
29
29
  Requires-Dist: pip-audit>=2.10.0; extra == 'dev'
30
- Requires-Dist: pyright[nodejs]>=1.1.408; extra == 'dev'
30
+ Requires-Dist: pyright[nodejs]>=1.1.409; extra == 'dev'
31
31
  Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
32
- Requires-Dist: pytest>=9.0.2; extra == 'dev'
32
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
33
33
  Requires-Dist: rtoml>=0.13.0; extra == 'dev'
34
- Requires-Dist: ruff>=0.15.7; extra == 'dev'
35
- Requires-Dist: textual>=8.1.1; extra == 'dev'
34
+ Requires-Dist: ruff>=0.15.12; extra == 'dev'
35
+ Requires-Dist: textual>=8.2.5; extra == 'dev'
36
36
  Requires-Dist: twine>=6.2.0; extra == 'dev'
37
37
  Description-Content-Type: text/markdown
38
38
 
@@ -48,7 +48,6 @@ Description-Content-Type: text/markdown
48
48
  [![Code Style: Ruff](https://img.shields.io/badge/Code%20Style-Ruff-46A3FF?logo=ruff&labelColor=000)](https://docs.astral.sh/ruff/)
49
49
  [![codecov](https://codecov.io/gh/bitranox/keep_github_workflows_active/graph/badge.svg?token=UFBaUDIgRk)](https://codecov.io/gh/bitranox/keep_github_workflows_active)
50
50
  [![Maintainability](https://qlty.sh/badges/041ba2c1-37d6-40bb-85a0-ec5a8a0aca0c/maintainability.svg)](https://qlty.sh/gh/bitranox/projects/keep_github_workflows_active)
51
- [![Known Vulnerabilities](https://snyk.io/test/github/bitranox/keep_github_workflows_active/badge.svg)](https://snyk.io/test/github/bitranox/keep_github_workflows_active)
52
51
  [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
53
52
 
54
53
  > **CI cadence:** The GitHub Actions CI workflow runs automatically every Monday at 07:00 UTC, in addition to push and pull request triggers.
@@ -1,14 +1,14 @@
1
1
  keep_github_workflows_active/__init__.py,sha256=tAEJPhRW07E84IzHijcwAf-iu8fhAf3TsvBUQqGz-fY,399
2
- keep_github_workflows_active/__init__conf__.py,sha256=SWeW14k5IXU7OPmRdO32t00P3hAM_7FGFIwIhnsmzE0,2562
2
+ keep_github_workflows_active/__init__conf__.py,sha256=6DYDkq64l2mfLEqxlL_7BOpjbnlMUbhaJGThe1xpJak,2562
3
3
  keep_github_workflows_active/__main__.py,sha256=79coRxvGs07uGBSdbw_HpcIv_rqogXvoEkv3lNEEIjE,3552
4
4
  keep_github_workflows_active/behaviors.py,sha256=PYDhp_ubXhLud2IVFLIJKylStu36W4Qm7E_daT2dOAM,3741
5
5
  keep_github_workflows_active/cli.py,sha256=KLLeRvnKuaE45GgX8GS-Aa5l7GGaKE7QjX7KtTV2ZUc,19007
6
6
  keep_github_workflows_active/doctest.env,sha256=WmDSq0QN1PFXpP4jq7JW_Kz-k5PT5uS8KzLrAEmJNC8,25
7
- keep_github_workflows_active/keep_github_workflow_active.py,sha256=4eETTyn-8sHCTtC_4qD3yjNbPwTMD31WpDMLroQ3V94,24685
7
+ keep_github_workflows_active/keep_github_workflow_active.py,sha256=F7y4hVmyL4kugvNY15ee0thfcEachxyfwGjoGAPL6qY,25659
8
8
  keep_github_workflows_active/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  keep_github_workflows_active/sanitization.py,sha256=zyPybyYLBWd__nITF8nyrubA3NJWXjyGkznw-4kJtyA,9801
10
- keep_github_workflows_active-2.1.5.dist-info/METADATA,sha256=-GC-KsPiTFLCTGAnwsBMUEetVgRefQhlvE-d5bLXqwU,9583
11
- keep_github_workflows_active-2.1.5.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
12
- keep_github_workflows_active-2.1.5.dist-info/entry_points.txt,sha256=6B8ytwKR2VIAj6IXUYhF957dlfulwTPPLR39RBXwCM0,156
13
- keep_github_workflows_active-2.1.5.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
14
- keep_github_workflows_active-2.1.5.dist-info/RECORD,,
10
+ keep_github_workflows_active-2.3.0.dist-info/METADATA,sha256=EtIPK-8uTe61yJQkO1vUHqFbaYv7K-wekxP_QdBE1l0,9413
11
+ keep_github_workflows_active-2.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
12
+ keep_github_workflows_active-2.3.0.dist-info/entry_points.txt,sha256=6B8ytwKR2VIAj6IXUYhF957dlfulwTPPLR39RBXwCM0,156
13
+ keep_github_workflows_active-2.3.0.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
14
+ keep_github_workflows_active-2.3.0.dist-info/RECORD,,