<commit_before>param (
    [string]$commitish = "master"
 )

############################
# Update Assembly version
############################

$pattern = '^\[assembly: AssemblyVersion\("(.*)"\)\]'
$assemblyFiles = Get-ChildItem -Recurse . AssemblyInfo.cs

$nugetIndexStr = Get-Content nuget-index.json | out-string
$nugetIndexJson = ConvertFrom-Json $nugetIndexStr
$lastPackageBuildNo = ($nugetIndexJson.items.upper | select-string -pattern '^\d+\.\d+\.(\d+).*').matches.groups[1].Value

$buildCounter = $lastPackageBuildNo
if ([string]::IsNullOrWhitespace($buildCounter)) {
	$buildCounter = "0"
}

$major = "0"
$minor = "4"
$build = $buildCounter
$revision = "0"
$newVersion = "{0}.{1}.{2}" -f $major, $minor, $build
$newAssemblyVersion = "{0}.{1}.{2}.{3}" -f $major, $minor, $build, $revision

foreach ($file in $assemblyFiles) {
	(Get-Content $file.PSPath) | ForEach-Object {
		if ($_ -match $pattern) {
			# We have found the matching line
			# Edit the version number and put back.
			write-host "Setting AssemblyInfo version to $newAssemblyVersion"
			'[assembly: AssemblyVersion("{0}")]' -f $newAssemblyVersion
		}
		else {
			# Output line as is
			$_
		}
	} | Set-Content $file.PSPath
}

##########################################################
# Write the POST body for the GitHub API Release-command
##########################################################

write-host Creating GitHub API release-request.json
'{ "tag_name": "v' + $newVersion + '", "target_commitish": "' + $commitish + '", "name": "v' + $newVersion + '", "body": "Version ' + $newVersion + '", "draft": true, "prerelease": true }' | Out-File -FilePath "release-request.json"
<commit_msg>Remember to increment build number...<commit_after>param (
    [string]$commitish = "master"
 )

############################
# Update Assembly version
############################

$pattern = '^\[assembly: AssemblyVersion\("(.*)"\)\]'
$assemblyFiles = Get-ChildItem -Recurse . AssemblyInfo.cs

$nugetIndexStr = Get-Content nuget-index.json | out-string
$nugetIndexJson = ConvertFrom-Json $nugetIndexStr
$lastPackageBuildNo = ($nugetIndexJson.items.upper | select-string -pattern '^\d+\.\d+\.(\d+).*').matches.groups[1].Value

$buildCounter = ([long]$lastPackageBuildNo + 1).ToString()

$major = "0"
$minor = "4"
$build = $buildCounter
$revision = "0"
$newVersion = "{0}.{1}.{2}" -f $major, $minor, $build
$newAssemblyVersion = "{0}.{1}.{2}.{3}" -f $major, $minor, $build, $revision

foreach ($file in $assemblyFiles) {
	(Get-Content $file.PSPath) | ForEach-Object {
		if ($_ -match $pattern) {
			# We have found the matching line
			# Edit the version number and put back.
			write-host "Setting AssemblyInfo version to $newAssemblyVersion"
			'[assembly: AssemblyVersion("{0}")]' -f $newAssemblyVersion
		}
		else {
			# Output line as is
			$_
		}
	} | Set-Content $file.PSPath
}

##########################################################
# Write the POST body for the GitHub API Release-command
##########################################################

write-host Creating GitHub API release-request.json
'{ "tag_name": "v' + $newVersion + '", "target_commitish": "' + $commitish + '", "name": "v' + $newVersion + '", "body": "Version ' + $newVersion + '", "draft": true, "prerelease": true }' | Out-File -FilePath "release-request.json"

{'fraction_non_alphanumeric': 0.26634528472431457, 'fraction_numerical': 0.00783368484483278, 'mean_word_length': 4.9391771019677995, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '467980', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1044, 'n_words': 249}