diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 9991dbe57..c42998e37 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -4,7 +4,7 @@ on:
push:
branches:
- main
- pull_request_target:
+ pull_request:
types: [opened, synchronize]
branches:
- main
@@ -12,7 +12,7 @@ on:
jobs:
framework:
name: Build and Test - Framework
- runs-on: windows-latest
+ runs-on: windows-2019
steps:
- name: Checkout
@@ -35,6 +35,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '2.0.0'
- name: Build
run: dotnet build .\Box.V2.Core
- name: Test
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 9b6901e14..0eaa61b7d 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,9 +1,6 @@
name: Lint Code Base
on:
- push:
- branches:
- - main
pull_request_target:
types: [opened, synchronize]
branches:
@@ -25,5 +22,6 @@ jobs:
VALIDATE_ALL_CODEBASE: false
VALIDATE_YAML: false
VALIDATE_JSCPD: false
+ VALIDATE_POWERSHELL: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/Box.V2.Test/Box.V2.Test.csproj b/Box.V2.Test/Box.V2.Test.csproj
index d7d6a706a..0a104fe73 100644
--- a/Box.V2.Test/Box.V2.Test.csproj
+++ b/Box.V2.Test/Box.V2.Test.csproj
@@ -12,7 +12,6 @@
-
diff --git a/build/bump_version.ps1 b/build/bump_version.ps1
index 9206b17de..aa562de37 100644
--- a/build/bump_version.ps1
+++ b/build/bump_version.ps1
@@ -81,6 +81,60 @@ $NEXT_VERSION_TAG = "v" + "$NEXT_VERSION"
$RELEASE_DATE = (Select-String -Pattern "\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])" -Path $CHANGELOG_PATH | Select-Object -First 1).Matches.Value
$RELEASE_NOTE_LINK = $NEXT_VERSION.Replace(".", "") + "-" + "$RELEASE_DATE"
+###########################################################################
+# Reorder changelog sections
+###########################################################################
+
+$sections = @()
+$sections += ('### ⚠ BREAKING CHANGES')
+foreach($line in Get-Content $VERSIONRC_PATH) {
+ $found = $line -match '(?<=section": ").*(?=",)'
+ if ($found) {
+ $sections += $matches[0]
+ }
+}
+
+$orderedSections = new-object string[] $sections.Length
+$currentSection = $null
+$previousSectionIndex = 0
+
+foreach($line in Get-Content $CHANGELOG_PATH) {
+ if($line -match "#{2,3} [[0-9]+\.[0-9]+\.[0-9]+]"){
+ if($VersionFound){
+ if(![string]::IsNullOrWhiteSpace($currentSection)){
+ $orderedSections[$previousSectionIndex] = $currentSection
+ }
+ break
+ }
+ $VersionFound = $true
+ continue
+ }
+ if($VersionFound){
+ for ($i=0; $i -lt $sections.Length; $i++)
+ {
+ if($line -match [Regex]::Escape($sections[$i])){
+ if(![string]::IsNullOrWhiteSpace($currentSection)){
+ $orderedSections[$previousSectionIndex] = $currentSection
+ }
+ $previousSectionIndex = $i
+ $currentSection = $null
+ continue
+ }
+ }
+ $currentSection += "$line`n"
+ }
+}
+
+$orderedSectionsAsString
+
+foreach($orderedSection in $orderedSections){
+ $orderedSectionsAsString += $orderedSection
+}
+
+$fileContent = Get-Content $CHANGELOG_PATH -Raw
+$result = [regex]::match($fileContent, '(?s)(### [^\[].*?)#{2,3} [[0-9]+\.[0-9]+\.[0-9]+]').Groups[1].Value
+$fileContent -replace [Regex]::Escape($result), $orderedSectionsAsString | Set-Content $CHANGELOG_PATH
+
###########################################################################
# Bump version files
###########################################################################
diff --git a/build/draft_release.ps1 b/build/draft_release.ps1
index 4afbea212..aae216a68 100644
--- a/build/draft_release.ps1
+++ b/build/draft_release.ps1
@@ -76,7 +76,7 @@ if ($InstallDependencies){
$VersionFound = $false
foreach($line in Get-Content $CHANGELOG_PATH) {
- if($line -match "## [[0-9]+\.[0-9]+\.[0-9]+]"){
+ if($line -match "#{2,3} [[0-9]+\.[0-9]+\.[0-9]+]"){
if($VersionFound){
break
}
diff --git a/build/variables.ps1 b/build/variables.ps1
index 05ef3a343..5b06b867c 100644
--- a/build/variables.ps1
+++ b/build/variables.ps1
@@ -18,3 +18,4 @@ $FRAMEWORK_PDB_PATH=$FRAMEWORK_PROJ_DIR + "\bin\Release\Box.V2.pdb"
$CORE_PDB_PATH=$CORE_PROJ_DIR + "\bin\Release\netstandard2.0\Box.V2.Core.pdb"
$PFX_PATH="$FRAMEWORK_PROJ_DIR" + "\BoxSDKKey.pfx"
$TEST_PATH="$ROOT_DIR" + "\Box.V2.Test"
+$VERSIONRC_PATH="$ROOT_DIR" + "\.versionrc"