a robot with github

Related tags

Miscellaneous gitbot
Overview

GitBot

github 机器人:这是一个基于Github API的机器人,建立一些项目的规范(如 issue 格式、 pull request 格式、配置一些指定 label 根据的 owner 、统一 git commit log 格式等),基于 github webhooksgithub api 让机器人(通常是一个单独的帐号,如 @AnkioBot )自动处理一些事情,从而达到快速响应、自动化、解放人力的效果。

声明

仓库@dreamncn/gitbot 是用来演示 GitBot 的基本功能,因为具体需要实现的功能,可能因项目而不同,如果你需要她,你可以 fork 并相应的添加、删除功能。以下功能是一些常用的 show case 。

功能 - Feature

Issue

  • 没有使用 创建 issue 页面提交的 issue 将直接被关闭 - 示例
  • 根据 创建 issue 页面提交的 issue 类型自动打上对应 label - 示例
  • 当 issue 标记 label 为 need demo 时,自动回复,需要相关demo - 示例
  • issue 自动 assign 给指定人员,需要配置 package.jsonconfig.github-bot.labelToAuthor 映射 - 示例

Pull Request

  • 发 PR 时根据打的 label 自动添加指定的 reviewer ,需要配置 package.jsonconfig.github-bot.labelToAuthor 映射 - 示例
  • 发 PR 时标题不规范时提醒修改,需要配置 package.jsonconfig.validate-commit-msg.type 功能关键字,标题必须以 功能关键字: 开头 - 示例
  • 发 PR 时自动根据标题的 PR 标题规则 前缀生成对应的 label , feat->enhancement, fix->bug - 示例

Release

  • 当往远程第一次推送新版本号时,自动列出最新版本距离上一版本的 commit log 并发布 release notes ,由于需要使用两个 tag 去对比,所以项目的第一个 tag 就不处理 - 示例

规则 - Rules

issue 规则

必须使用 创建 issue 页面来提交 issue ,否则将直接被关闭

labels 规则

  • invalid - 未定义, 内容 不规范
  • need demo - 需要提供预览链接
  • need update - 需要更新修复问题
  • bug - bug
  • duplicate - 重复
  • enhancement - 新功能
  • question - 提问
  • wontfix - 不修复的问题

commit log 和 PR 标题规则

所有标题必须以 功能关键字: 开头

参考: http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html

功能关键字介绍如下:

  • feat - 新功能(feature)
  • fix - 修补bug
  • docs - 文档(documentation)
  • style - 格式(不影响代码运行的变动)
  • test - 增加测试
  • chore - 构建过程或辅助工具的变动
  • revert - 撤销
  • close - 关闭 issue
  • release - 发布版本

示例:

close: #1, #3
feat: 添加xx功能
docs: update install info

如何使用

1. 创建 access tokens

https://github.com/settings/tokens需要在 .env 里配置

2. 创建 webhook

https://github.com/用户名/项目名/settings/hooks/new

  • Payload URL: www.example.com:8000
  • Content type: application/json
  • trigger: Send me everything.
  • Secret: xxx (需要在 .env 里配置

3. 开发运行

npm install
cp env .env
vim .env
npm start

4. 部署

本项目使用 pm2 进行服务管理,发布前请先全局安装 pm2

npm install pm2 -g
npm run deploy

后台启动该服务后,可以通过 pm2 ls 来查看服务名称为 github-bot 的运行状态。具体 pm2 使用,请访问:https://github.com/Unitech/pm2

contributors

Liscense

Apache 2.0

You might also like...
Compare your Github followers vs following users

followers-vs-following Compare your Github followers vs following users https://docs.github.com/en/rest/reference/users The code only queries 3k follo

The goal of this course is to give you a brief introduction to GitHub.
The goal of this course is to give you a brief introduction to GitHub.

👋 The Basics of GitHub 🤓 Course overview and learning outcomes The goal of this course is to give you a brief introduction to GitHub. We’ll also pro

Discover your ranking on GitHub
Discover your ranking on GitHub

Git stars About This project was inspired by Git Awards! Since it apparently isn't supported anymore we thought we'd take the concept back and add our

This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions.

Workflow This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions. Installation To install this

php-rutheeshraja created by GitHub Classroom
php-rutheeshraja created by GitHub Classroom

demo hosting of this :https://phpcomiconmail.herokuapp.com/ code is in php_rtcamp folder Index.php(demo) validation: .user need to must enter gmail ac

This plugin allows you to display code from a repository, such as Github, Gitlab or others in order to use it as a resource in the courses.

Fetch Code This plugin allows you to display code from a repository, such as Github, Gitlab or others in order to use it as a resource in the courses.

 GitHub Actions for Magento 2 Extensions
GitHub Actions for Magento 2 Extensions

GitHub Actions for Magento 2 Extensions This repository's aim is to provide a set of open sourced GitHub actions to write better tested Magento 2 exte

The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).
The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).

JBZoo / CI-Report-Converter Why? Installing Using as GitHub Action Example GitHub Action workflow Available Directions Help description in terminal Co

Sanitize untrustworthy HTML user input (Symfony integration for https://github.com/tgalopin/html-sanitizer)

html-sanitizer is a library aiming at handling, cleaning and sanitizing HTML sent by external users (who you cannot trust), allowing you to store it and display it safely. It has sensible defaults to provide a great developer experience while still being entierely configurable.

Owner
Dreamn
A Boy
Dreamn
Run your WP site on github pages, php innovation award winner https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html

Gitpress Run wordpress directly on github pages Gitpress won the innovation award for may 2021 Read more about this https://naveen17797.github.io/gitp

naveen 13 Nov 18, 2022
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Utility Classes This library provides a range of utility classes that are used throughout the CakePHP framework What's in the toolbox? Hash A

CakePHP 112 Feb 15, 2022
A Twitter bot powered by Github Actions tweeing Wikidata milestones

Twitter WikidataMeter Bot I'm the code, and deployment of Twitter bot WikidataMeter. I tweet a few fun things about Wikidata as it grows. Tweets Feel

null 9 Dec 9, 2022
Issue tracking application extending GitHub's issues and pull requests for the Joomla! project.

Requirements The issue tracker application requires a server running: PHP 7.2 or 7.3 PHP's ext/curl and ext/intl should also be installed MySQL 5.5.3

Joomla! 68 Oct 27, 2022
Laradeploy offers you to automate deployment using a GitHub webhook.

Introduction Laradeploy offers you to automate deployment using a GitHub webhook. Simple and fast just make a git push to GitHub deploy the new modifi

Gentrit Abazi 10 Feb 21, 2022
Plant Watering Sensor Project for Zigbee Network (based on the Source Code of the DIYRUZ Flower Project - https://github.com/diyruz/flower).

Plant-Watering-Sensor-Zigbee Plant Watering Sensor Project for Zigbee Network (based on the Source Code of the DIYRUZ Flower Project

Andrew Lamchenko 80 Dec 22, 2022
Create changelogs based on your GitHub milestones

changelog_generator.php This project provides a simple way to create a markdown ordered list of issues and pull requests closed with a given milestone

Rob Allen 3 Aug 30, 2021
Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more

Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more

MantisBT Community Plugins 175 Sep 3, 2022
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

Shivam Mathur 2.4k Jan 6, 2023
Visitor Badge for your Web or Github repository

visitor-badge Visitor Badge untuk Website atau Github repository, Dibuat dengan ❤ dan PHP native oleh Saya Demo Langsung Anda bisa me-refresh halaman

Feri Irawan 37 Dec 22, 2022