Install a plugin from a GitHub Actions artifact.
(
ctx: click.Context,
url: str,
signature_mode: SignatureVerificationMode = SignatureVerificationMode.STRICT,
)
| 381 | |
| 382 | |
| 383 | def _install_from_github_artifact( |
| 384 | ctx: click.Context, |
| 385 | url: str, |
| 386 | signature_mode: SignatureVerificationMode = SignatureVerificationMode.STRICT, |
| 387 | ) -> None: |
| 388 | """Install a plugin from a GitHub Actions artifact.""" |
| 389 | ui.display_warning("GitHub artifacts are ephemeral and cannot be auto-updated.") |
| 390 | |
| 391 | downloader = PluginDownloader() |
| 392 | enterprise_config = EnterpriseConfig.load() |
| 393 | |
| 394 | ui.display_info("Installing from GitHub artifact...") |
| 395 | |
| 396 | try: |
| 397 | plugin_name, version, installed_wheel = ( |
| 398 | downloader.download_from_github_artifact(url, signature_mode=signature_mode) |
| 399 | ) |
| 400 | |
| 401 | plugin_name = enable_installed_plugin( |
| 402 | enterprise_config, plugin_name, version, installed_wheel |
| 403 | ) |
| 404 | enterprise_config.save() |
| 405 | |
| 406 | ui.display_info(f"Installed {plugin_name} v{version}") |
| 407 | |
| 408 | except SignatureVerificationError as e: |
| 409 | ui.display_error(f"Signature verification failed: {e}") |
| 410 | ui.display_info( |
| 411 | "This plugin is not signed by GitGuardian. " |
| 412 | "If you trust its origin and still want to install it, " |
| 413 | "pass --allow-unsigned." |
| 414 | ) |
| 415 | ctx.exit(ExitCode.UNEXPECTED_ERROR) |
| 416 | except GitHubArtifactError as e: |
| 417 | ui.display_error(str(e)) |
| 418 | ctx.exit(ExitCode.UNEXPECTED_ERROR) |
| 419 | except Exception as e: |
| 420 | ui.display_error(f"Failed to install from GitHub artifact: {e}") |
| 421 | ctx.exit(ExitCode.UNEXPECTED_ERROR) |
no test coverage detected