zenozeng / gitlab-changelog
一个简单的PHP脚本,通过GitLab API v3生成变更日志
v0.2.0
2015-06-26 02:53 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-28 16:15:24 UTC
README
一个通过GitLab API v3生成变更日志的PHP脚本
用法
composer.json
{ "require": { "zenozeng/gitlab-changelog": "0.1.1" } }
index.php
<?php require "vendor/autoload.php"; use GitlabChangelog\GitlabChangelog; $changelog = new GitlabChangelog(); $changelog->url = "http://gitlab.alibaba-inc.com/"; $changelog->repo = "ata/atatech-kb"; $changelog->token = "YOUR PRIVATE TOKEN"; $changelog->milestoneFilter = function($milestone) { $ignore = array("todo", "long running task", "team", "next release"); return !in_array($milestone->title, $ignore); }; $changelog->getLabels = function($issue) { $label = "Fixed"; $map = array( "bug" => "Fixed", "enhancement" => "Improved", "feature" => "Added" ); foreach($map as $k => $v) { if(strripos(implode(',', $issue->labels), $k) !== FALSE) { $label = $v; break; } } return array($label); }; $changelog->debug = true; $markdown = $changelog->markdown(); file_put_contents("changelog.md", $markdown); ?>
运行
composer install php index.php