Automatically label PRs (#9418)

* Automatically label and merge PRs
This commit is contained in:
Amir Omidi
2020-03-05 16:46:06 -08:00
committed by GitHub
parent 673e5a85cb
commit 76cf10d23c
23 changed files with 74960 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Toolkit } from 'actions-toolkit';
const tools = new Toolkit({
event: 'issue_comment',
secrets: ['GITHUB_TOKEN']
});
const label = tools.inputs.label || 'Port Request';
async function run() {
try {
let prNumber = tools.context.payload?.pull_request?.number;
if (prNumber === undefined) {
console.error('PR Number was undefined');
tools.log.error('PR Number was undefined');
return;
}
tools.github.issues.addLabels({
...tools.context.repo,
labels: [label],
issue_number: prNumber
});
} catch (ex) {
console.error(ex);
tools.log.error(ex);
}
}
run();