subdee/gitlab-chlog

A simple php script to generate changelog via gitlab API v3

0.0.4 2015-07-09 11:52 UTC

This package is auto-updated.

Last update: 2024-10-23 06:10:14 UTC


README

A php script to generate changelog via gitlab api v3

Usage

composer.json:

{
    "require": {
        "subdee/gitlab-changelog": "0.0.1"
    }
}

index.php:

<?php
require "vendor/autoload.php";

use GitlabChangelog\GitlabChangelog;

$changelog = new GitlabChangelog();
$changelog->url = "GITLAB URL";
$changelog->repo = "REPO NAME";
$changelog->token = "YOUR PRIVATE TOKEN";

$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);
};

$markdown = $changelog->markdown();

file_put_contents("changelog.md", $markdown);

Run:

composer install
php index.php