<commit_before><?php

if (isset($argv[1]) === false) {
    echo "Usage $argv[0] [version]\n";

    return;
}
$version = trim($argv[1], 'v');

echo "Updating git repository...\n";
shell_exec('git pull');

$tags = explode("\n", trim(shell_exec('git tag')));
if (in_array("v$version", $tags)) {
    echo "Version $version already exists\n";

    return;
}

$accessTokenCmd = 'composer config --global "github-oauth.github.com"';
$accessToken = shell_exec($accessTokenCmd);

$releaseCmd = strtr('curl --silent --data \'{"tag_name": "v%version%","target_commitish": "master","name": "v%version%","body": "Release %version% (%date%)","draft": false,"prerelease": false}\' https://api.github.com/repos/%owner%/%repository%/releases?access_token=%access_token%', array(
    '%date%' => date('Y-m-d'),
    '%version%' => $version,
    '%access_token%' => $accessToken,
    '%repository%' => 'subway',
    '%owner%' => 'eymengunay'
));
echo "Creating new release...\n";
shell_exec($releaseCmd);
<commit_msg>GitHub prerelease support for build<commit_after><?php

if (isset($argv[1]) === false) {
    echo "Usage $argv[0] [version]\n";

    return;
}
$version = trim($argv[1], 'v');

echo "Updating git repository...\n";
shell_exec('git pull');

$tags = explode("\n", trim(shell_exec('git tag')));
if (in_array("v$version", $tags)) {
    echo "Version $version already exists\n";

    return;
}

$accessTokenCmd = 'composer config --global "github-oauth.github.com"';
$accessToken = shell_exec($accessTokenCmd);

$releaseCmd = strtr('curl --silent --data \'{"tag_name": "v%version%","target_commitish": "master","name": "v%version%","body": "Release %version% (%date%)","draft": false,"prerelease": %prerelease%}\' https://api.github.com/repos/%owner%/%repository%/releases?access_token=%access_token%', array(
    '%date%' => date('Y-m-d'),
    '%version%' => $version,
    '%access_token%' => $accessToken,
    '%repository%' => 'subway',
    '%owner%' => 'eymengunay',
    '%prerelease%' => isset($argv[2]) && trim($argv[2]) === 'pre' ? 'true' : 'false'
));
echo "Creating new release...\n";
shell_exec($releaseCmd);

{'fraction_non_alphanumeric': 0.23802750118539592, 'fraction_numerical': 0.003793266951161688, 'mean_word_length': 5.242603550295858, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3886562', 'n_tokens_mistral': 751, 'n_tokens_neox': 738, 'n_words': 146}