Giter Site home page Giter Site logo

gitlab-changelog's Introduction

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://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

关于 PSR-4

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

gitlab-changelog's People

Contributors

zenozeng avatar ivany4 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.