Skip to content

Instantly share code, notes, and snippets.

@lloc
Created January 2, 2018 23:31
Show Gist options
  • Save lloc/8120e24490ade7bff539d25be0c8f064 to your computer and use it in GitHub Desktop.
Save lloc/8120e24490ade7bff539d25be0c8f064 to your computer and use it in GitHub Desktop.
Script for the changelog.php post
<?php
namespace lloc\changelog;
exec( 'git fetch --tags' );
$cmd = 'git tag -l --format="%(creatordate:iso8601)|%(refname:short)" | sort -r';
$arr = ( new ArrayOutput( $cmd ) )->get();
$tags = new Tags( $arr );
$cmd = sprintf(
'git log %s...%s --pretty=oneline --abbrev-commit',
$tags->get_name( 1 ),
$tags->get_name()
);
$arr = ( new ArrayOutput( $cmd ) )->get();
$logs = ( new Logs() )->add( $arr );
echo $tags->get_title();
echo $logs->get( 'feat', 'Features' );
echo $logs->get( 'fix', 'Bug Fixes' );
echo $logs->get( 'chore', 'Cleanup' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment