dragon-code/github-notifications

减轻你在GitHub上的通知负担!

1.10.0 2024-08-30 10:01 UTC

README

The Dragon Code: GitHub Notifications

Stable Version Total Downloads Github Workflow Status License

GitHub Notifications由The Dragon Code创建并维护,是一个简单的命令行工具,用于在指定组织中标记所有有关问题或拒绝的PR的通知为已读。

安装

需要PHP 8.2+。要获取最新版本,只需使用Composer引入项目。

composer global require dragon-code/github-notifications:*

或者,您可以简单地克隆仓库,并在文件夹中运行composer install

更新全局依赖

要更新全局依赖,请使用控制台命令

composer global update

身份验证

您还需要创建一个用于GitHub API的具有对notifications范围访问权限的个人访问令牌

默认情况下,我们按以下顺序检查令牌的存在位置

  1. 调用控制台命令时传递的token参数
  2. GITHUB_TOKEN环境变量
  3. ~/.composer/auth.json文件
  4. ~/.config/.composer/auth.json文件
  5. ~/.config/composer/auth.json文件
  6. ~/AppData/Roaming/Composer/auth.json文件
  7. ~/composer/auth.json文件
  8. %USERPROFILE%/AppData/Roaming/Composer/auth.json文件

如果找不到令牌,您将收到一条关于此的消息。

用法

读取所有问题通知

notifications read

清除Laravel组织中的所有问题通知

notifications read laravel

或者,如果您指定了令牌

notifications read laravel --token {...}

此外,您可以使用组织名称和/或存储库名称的任何部分来与模板进行匹配

notifications read laravel/framework
# or
notifications read lara*/fra
# or
notifications read framework
# or
notifications read work
# or
notifications read fra*rk

模式匹配是通过使用Str::is方法实现的。

您也可以指定多个名称

notifications read laravel/framework laravel/jet

在确定名称时,使用str_starts_with函数。

选项

默认情况下,只有已关闭或合并的问题和拉取请求会被标记为已读。

但您也可以自定义参数

-r, --except-repository  Exclude repositories from processing
-i, --except-issues      Exclude issues from processing
-p, --except-pulls       Exclude Pull Requests from processing
-m, --except-mentions    Exclude notifications with your mention from processing
-o, --with-open          Process including open Issues and Pull Requests
-n, --no-interaction     Do not ask any interactive question
-q, --quiet              Do not output any message

例如

# except issues + with open
notifications read laravel -ion

使用这组选项,以下通知会被标记为已读

  • 其存储库名称以单词laravel开头
  • 仅拉取请求,包括已打开和已关闭的请求
  • 将不会在控制台中请求继续

您可以通过调用控制台命令来显示帮助信息

notifications read --help

您还可以排除某些存储库

notifications read laravel -ion -r laravel/framework -r laravel/breeze

使用这组选项,以下通知会被标记为已读

  • 其存储库名称以单词laravel开头
  • 仅拉取请求,包括已打开和已关闭的请求
  • 将不会在控制台中请求继续
  • 存储库laravel/frameworklaravel/breeze将不会被处理

结果

之前

执行以下参数的控制台命令

notifications read -n --except-mentions

before

之后

after

使用--with-open选项后的结果

执行以下参数的控制台命令

notifications read -n --except-mentions --with-open

after

支持我们

❤️喜欢The Dragon Code?请考虑在我们的Boosty上支持我们的集体。

许可证

此软件包根据MIT许可证授权。