imbi-plugin-github 2.57.0__tar.gz → 2.59.0__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 (33) hide show
  1. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/PKG-INFO +2 -2
  2. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/pyproject.toml +2 -2
  3. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/secret_provider.py +6 -3
  4. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_secret_provider.py +40 -0
  5. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/.gitignore +0 -0
  6. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/README.md +0 -0
  7. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/moon.yml +0 -0
  8. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/README.md +0 -0
  9. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/__init__.py +0 -0
  10. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/_app_auth.py +0 -0
  11. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/_hosts.py +0 -0
  12. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/_repos.py +0 -0
  13. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/commits.py +0 -0
  14. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/deployment.py +0 -0
  15. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/doctor.py +0 -0
  16. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/identity.py +0 -0
  17. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/lifecycle.py +0 -0
  18. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/plugin.py +0 -0
  19. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/public.py +0 -0
  20. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/pull_requests.py +0 -0
  21. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/src/imbi/plugins/github/py.typed +0 -0
  22. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/__init__.py +0 -0
  23. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_app_auth_scopes.py +0 -0
  24. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_commits.py +0 -0
  25. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_deployment.py +0 -0
  26. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_doctor.py +0 -0
  27. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_hosts.py +0 -0
  28. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_identity.py +0 -0
  29. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_lifecycle.py +0 -0
  30. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_public.py +0 -0
  31. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_pull_requests.py +0 -0
  32. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_repos.py +0 -0
  33. {imbi_plugin_github-2.57.0 → imbi_plugin_github-2.59.0}/tests/test_secret_provider_live.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: imbi-plugin-github
3
- Version: 2.57.0
3
+ Version: 2.59.0
4
4
  Summary: GitHub identity plugin for Imbi (github.com / GHEC / GHES)
5
5
  Author-email: "Gavin M. Roy" <gavinr@aweber.com>
6
6
  License-Expression: BSD-3-Clause
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.14
13
13
  Requires-Python: >=3.14
14
14
  Requires-Dist: httpx>=0.27
15
- Requires-Dist: imbi-common[databases]==2.57.0
15
+ Requires-Dist: imbi-common[databases]==2.59.0
16
16
  Requires-Dist: pydantic>=2
17
17
  Requires-Dist: pyjwt[crypto]>=2.8
18
18
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "imbi-plugin-github"
3
- version = "2.57.0"
3
+ version = "2.59.0"
4
4
  description = "GitHub identity plugin for Imbi (github.com / GHEC / GHES)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -18,7 +18,7 @@ classifiers = [
18
18
  ]
19
19
  dependencies = [
20
20
  "httpx>=0.27",
21
- "imbi-common[databases]==2.57.0",
21
+ "imbi-common[databases]==2.59.0",
22
22
  "pydantic>=2",
23
23
  "pyjwt[crypto]>=2.8",
24
24
  ]
@@ -76,15 +76,18 @@ PURPOSE_PERMISSIONS: dict[str, dict[str, str]] = {
76
76
  },
77
77
  }
78
78
 
79
- #: CI read permissions that a purpose adds when the installation grants
80
- #: them, so an agent can wait for and read checks. Asking for one the
81
- #: installation lacks would make GitHub refuse the whole token (422).
79
+ #: Permissions that a purpose adds when the installation grants them:
80
+ #: CI reads, so an agent can wait for and read checks, and for
81
+ #: ``github_write`` also ``workflows``, which GitHub requires to push a
82
+ #: change under ``.github/workflows/``. Asking for one the installation
83
+ #: lacks would make GitHub refuse the whole token (422).
82
84
  PURPOSE_OPTIONAL_PERMISSIONS: dict[str, dict[str, str]] = {
83
85
  'github_read': {'checks': 'read', 'statuses': 'read'},
84
86
  'github_write': {
85
87
  'actions': 'read',
86
88
  'checks': 'read',
87
89
  'statuses': 'read',
90
+ 'workflows': 'write',
88
91
  },
89
92
  }
90
93
 
@@ -447,6 +447,46 @@ class GitHubAppTestCase(unittest.IsolatedAsyncioTestCase):
447
447
  },
448
448
  )
449
449
 
450
+ @respx.mock
451
+ async def test_workflows_write_only_when_the_installation_grants_it(
452
+ self,
453
+ ) -> None:
454
+ """A write token can push workflow files when the App may."""
455
+ respx.get(INSTALLATION_URL).mock(
456
+ return_value=httpx.Response(
457
+ 200,
458
+ json=INSTALLATION
459
+ | {
460
+ 'permissions': {
461
+ 'contents': 'write',
462
+ 'workflows': 'write',
463
+ 'metadata': 'read',
464
+ }
465
+ },
466
+ )
467
+ )
468
+ route = respx.post(TOKENS_URL).mock(
469
+ return_value=httpx.Response(
470
+ 201,
471
+ json={'token': TOKEN, 'expires_at': '2099-01-01T00:00:00Z'},
472
+ )
473
+ )
474
+ await APP.resolve(CONFIG, LOCATOR, None, _context('github_write'))
475
+ self.assertEqual(
476
+ json.loads(route.calls.last.request.content)['permissions'],
477
+ {
478
+ 'contents': 'write',
479
+ 'issues': 'write',
480
+ 'pull_requests': 'write',
481
+ 'workflows': 'write',
482
+ },
483
+ )
484
+ await APP.resolve(CONFIG, LOCATOR, None, _context('github_read'))
485
+ self.assertNotIn(
486
+ 'workflows',
487
+ json.loads(route.calls.last.request.content)['permissions'],
488
+ )
489
+
450
490
  @respx.mock
451
491
  async def test_disallowed_host_gets_no_jwt(self) -> None:
452
492
  """A host that left the allowlist after the provider was saved."""