Skip to content

Commit 9a08447

Browse files
committed
Add Github Actions automations (#4405)
* Add Github Actions automations - labeler: used for versions and marking commits as Infra - backport: we can now apply labels `backport $branch` and on PR close this will automatically open up the appropiate backport PR's If you call the release target e.g $ ./build.sh release 8.0.0-alpha2 This will now bump the version in both global.json as well as the autolabel.json * fix casing on label (cherry picked from commit f0ee705)
1 parent afa9791 commit 9a08447

File tree

7 files changed

+59
-50
lines changed

7 files changed

+59
-50
lines changed

.github/auto-label.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rules": {
3+
"Infra": [".ci/**/*", ".github/**/*","build/**/*"],
4+
"v8.0.0-alpha1": "**/*"
5+
}
6+
}

.github/workflows/auto-label.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Auto Label
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
6+
jobs:
7+
auto-label:
8+
name: Auto Label
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: banyan/[email protected]
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/backport.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Backport
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
- labeled
7+
8+
jobs:
9+
backport:
10+
runs-on: ubuntu-18.04
11+
name: Backport
12+
steps:
13+
- name: Backport
14+
uses: tibdex/backport@v1
15+
with:
16+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/yaml-runner.yml

-47
This file was deleted.

build/scripts/Versioning.fs

+14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ open System.Diagnostics
66
open System.IO
77
open Commandline
88
open Fake.Core
9+
open Fake.Core
910
open Fake.IO
1011
open Fake.IO.Globbing.Operators
1112
open Newtonsoft.Json
@@ -25,6 +26,18 @@ module Versioning =
2526
let jsonString = File.ReadAllText "global.json"
2627
JsonConvert.DeserializeObject<GlobalJson>(jsonString)
2728

29+
let writeVersionIntoAutoLabel oldVersion newVersion =
30+
let path = Path.Join(".github","auto-label.json")
31+
let text = File.ReadAllText(path)
32+
let oldV = sprintf "v%s" oldVersion
33+
let newV = sprintf "v%s" newVersion
34+
if not(text.Contains(oldV)) then
35+
failwithf "auto-label.json does not contain %s" oldV
36+
37+
let replaced = String.replace oldV newV text
38+
File.WriteAllText(path, replaced)
39+
40+
2841
let writeVersionIntoGlobalJson version =
2942
let globalJson = globalJson ()
3043
let doc_current =
@@ -88,6 +101,7 @@ module Versioning =
88101
if (currentVersion > newVersion) then
89102
failwithf "Can not release %O as it's lower then current %O" newVersion.Full currentVersion.Full
90103
writeVersionIntoGlobalJson newVersion.Full
104+
writeVersionIntoAutoLabel (currentVersion.Full.ToString()) (newVersion.Full.ToString())
91105
| _ -> ignore()
92106

93107
let ArtifactsVersion buildVersions =

build/scripts/scripts.fsproj

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@
2424
<Content Include="..\..\build.bat"><Link>build.bat</Link></Content>
2525
<Content Include="..\..\appveyor.yml"><Link>appveyor.yml</Link></Content>
2626
<Content Include="..\..\azure-pipelines.yml"><Link>azure-pipelines.yml</Link></Content>
27-
<Content Include="..\..\.github\workflows\yaml-runner.yml">
28-
<Link>yaml-runner.yml</Link>
27+
<Content Include="..\..\.github\workflows\auto-label.yml">
28+
<Link>auto-label.yml</Link>
29+
</Content>
30+
<Content Include="..\..\.github\workflows\backport.yml">
31+
<Link>backport.yml</Link>
32+
</Content>
33+
<Content Include="..\..\.github\auto-label.json">
34+
<Link>auto-label.json</Link>
2935
</Content>
3036
</ItemGroup>
3137
<ItemGroup>

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"version": "7.5.0",
66
"doc_current": "7.5",
77
"doc_branch": "7.x"
8-
}
8+
}

0 commit comments

Comments
 (0)