承接 artisan-build/gh 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

artisan-build/gh

Composer 安装命令:

composer require artisan-build/gh

包简介

README 文档

README

This package wraps the GitHub CLI for easy use in Laravel. We only use this as a dev dependency and everyone on our team has the GitHub CLI installed and authenticated locally. Using this as a non-dev dependency and managing the authentication on a remote server is beyond the scope of this documentation.

Installation

composer require artisan-build/gh

Configuration

[Warning] The default configuration file is optimized for how we use this package. It is set up to do some risky things like archive or delete repositories without confirmation. Carefully read the GitHub CLI documentation and edit the configuration file to meet your organization's needs

Usage

We've basically just created a fluid wrapper around the GitHub CLI, using the Laravel Process facade to actually run the commands. Below is a sample of what can be done. Please refer to the tests and the GitHub CLI documentation for a fuller view of what is possible with this package.

Auth

// Login using web
GH::auth()->login(null, null, true);

// Logout
GH::auth()->logout('github.com');

// Check status
GH::auth()->status();

Browse

// Open a repository
GH::browse('username/repository')->open();

// Open a specific branch
GH::browse('username/repository')->open('main');

// Open a specific commit
GH::browse('username/repository')->open(null, 'abc123');

Cache

// List caches
GH::cache()->list();

// Delete a cache
GH::cache()->delete('cache-key-123');

// Restore a cache
GH::cache()->restore('cache-key-123');

Codespace

// Create a codespace
GH::codespace()->create('username/repository', 'main', 'standardLinux');

// Stop a codespace
GH::codespace()->stop('codespace-name');

// View logs
GH::codespace()->logs('codespace-name');

Config

// Get a configuration value
GH::config()->get('editor');

// Set a configuration value
GH::config()->set('editor', 'vim');

// List all configuration values
GH::config()->list();

Gist

// Create a gist
GH::gist()->create(['file1.txt'], 'Test Gist', true);

// View a gist
GH::gist()->view('gist-id', true);

// Delete a gist
GH::gist()->delete('gist-id');

GPG Key

// Add a GPG key
GH::gpgKey()->add('path/to/key.gpg');

// List GPG keys
GH::gpgKey()->list();

// Delete a GPG key
GH::gpgKey()->delete('12345');

Issue

// Create a new issue
GH::issue('username/repository')->create('Issue Title', 'Issue Body', ['--label bug']);

// Edit an issue
GH::issue('username/repository')->edit('123', 'Updated Title', 'Updated Body');

// Close and reopen an issue
GH::issue('username/repository')->close('123');
GH::issue('username/repository')->reopen('123');

// Comment on an issue
GH::issue('username/repository')->comment('123', 'This is a comment.');

Label

// Create a label
GH::label('username/repository')->create('bug', 'Indicates a bug', 'FF0000');

// Edit a label
GH::label('username/repository')->edit('bug', 'fixed-bug', 'Resolved', '00FF00');

// Delete a label
GH::label('username/repository')->delete('bug');

Organization

// View organization details
GH::org('organization-name')->view();

// List members
GH::org('organization-name')->members();

// List pending invitations
GH::org('organization-name')->invitations();

Pull Request

// Create a new pull request
GH::pr('username/repository')->create('PR Title', 'PR Body', ['--base main', '--draft']);

// Edit a pull request
GH::pr('username/repository')->edit('123', 'Updated Title', 'Updated Body');

// Merge a pull request
GH::pr('username/repository')->merge('123', true); // Squash merge

// Close and reopen a pull request
GH::pr('username/repository')->close('123');
GH::pr('username/repository')->reopen('123');

Project

// List projects
GH::project('organization-name')->list();

// View project details
GH::project('organization-name')->view(123);

// Create a project
GH::project('organization-name')->create('New Project');

// Delete a project
GH::project('organization-name')->delete(123);

Release

// Create a release
GH::release('username/repository')->create('v1.0.0', 'Release Title', 'Release Notes');

// Upload an asset to a release
GH::release('username/repository')->uploadAsset('v1.0.0', 'path/to/file.zip', 'Asset Label');

// Delete a release
GH::release('username/repository')->delete('v1.0.0');

Repository

// Create a new repository
GH::repo('username/repository')->create();

// Clone a repository
GH::repo('username/repository')->clone('directory', 'https');

// Archive a repository
GH::repo('username/repository')->archive();

Ruleset

// Create a ruleset
GH::ruleset('username/repository')->create([
    'name' => 'My Ruleset',
    'enforcement' => 'active',
]);

// Enable a ruleset
GH::ruleset('username/repository')->enable('123');

Workflow Run

// List workflow runs
GH::run('username/repository')->list();

// View a workflow run
GH::run('username/repository')->view('123');

// Rerun a workflow
GH::run('username/repository')->rerun('123');

Search

// Search repositories
GH::search()->repos('laravel');

// Search issues
GH::search()->issues('bug label:bug');

Secret

// Set a secret
GH::secret('username/repository')->set('MY_SECRET', 'secret-value');

// Delete a secret
GH::secret('username/repository')->delete('MY_SECRET');

Status

// View status
GH::status()->show();

Variable

// List variables
GH::variable('username/repository')->list();

// Set a variable
GH::variable('username/repository')->set('ENV_VAR', 'value123');

Workflow

// Enable a workflow
GH::workflow('username/repository')->enable('workflow.yml');

// Disable a workflow
GH::workflow('username/repository')->disable('workflow.yml');

Memberware

This package is part of our internal toolkit and is optimized for our own purposes. We do not accept issues or PRs in this repository.

artisan-build/gh 适用场景与选型建议

artisan-build/gh 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.83k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 artisan-build/gh 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 artisan-build/gh 我们能提供哪些服务?
定制开发 / 二次开发

基于 artisan-build/gh 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-03