Skip to content

Commit 3632ef1

Browse files
committed
enable automerge
1 parent c561a5e commit 3632ef1

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ jobs:
2323
- name: Run CI tests
2424
run: npm test
2525
working-directory: ./tools
26+
27+
- name: Check RP in Autogenlist
28+
run: npm run find-basepath ${{ github.head_ref }}
29+
working-directory: ./generator
30+
31+
- name: automerge
32+
uses: "pascalgn/automerge-action@v0.12.0"
33+
env:
34+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
35+
MERGE_LABELS: ""

generator/cmd/findbasepath.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { executeSynchronous } from '../utils';
2+
import { findAutogenEntries } from '../autogenlist';
3+
4+
// this function analyzes a branch name and extracts the base path, then proceeds to find it in autogenlist
5+
// if not found, it throws an error
6+
executeSynchronous(async () => {
7+
if (!process.argv[2]) {
8+
throw new Error("Branch name missing. This cmd expects a branch name with the following format: 'AzureSDKAutomation:sdkAutomation/[basepath]'");
9+
}
10+
11+
const prName = process.argv[2];
12+
let basePath = prName.replace("AzureSDKAutomation:sdkAutomation/", "");
13+
14+
// format basePath
15+
basePath = `${basePath}/resource-manager`;
16+
17+
const autogenEntries = findAutogenEntries(basePath);
18+
19+
if (autogenEntries.length === 0) {
20+
//not found
21+
throw new Error(`Base path: '${basePath}' not found in autogenlist, this means RP hasn't been onboarded in schema autogeneration process yet.`)
22+
}
23+
24+
console.log(`Base path: '${basePath} found in autogenlist.`);
25+
});

generator/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"list-basepaths": "ts-node cmd/listbasepaths",
77
"list-resources": "ts-node cmd/listresources",
88
"generate-all": "ts-node cmd/generateall",
9+
"find-basepath": "ts-node cmd/findbasepath",
910
"generate-single": "ts-node cmd/generatesingle",
1011
"clean": "ts-node cmd/clean",
1112
"start": "npm run clean && npm run generate-all",

0 commit comments

Comments
 (0)