Skip to content

zenozeng/gitlab-changelog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitlab-changelog

A php script to generate changelog via gitlab api v3

Usage

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:https://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);
?>

Run:

composer install
php index.php

About PSR-4

http:https://culttt.com/2014/05/07/create-psr-4-php-package/

About

A php script to generate changelog via gitlab api

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages