mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
37
build/actions/AutoLabel/src/index.ts
Normal file
37
build/actions/AutoLabel/src/index.ts
Normal 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();
|
||||
Reference in New Issue
Block a user