mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-04-08 13:00:30 -04:00
7
.github/mergers.yml
vendored
Normal file
7
.github/mergers.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[
|
||||||
|
"kenvanhyning",
|
||||||
|
"kburtram",
|
||||||
|
"udeeshagautam",
|
||||||
|
"qifahs",
|
||||||
|
"chlafreniere"
|
||||||
|
]
|
||||||
16
.github/workflows/merger.yml
vendored
Normal file
16
.github/workflows/merger.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: AutoMerger
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release_labeler:
|
||||||
|
name: Auto Merger
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./build/actions/AutoMerge/dist/index.js
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
19
.github/workflows/portlabel.yml
vendored
Normal file
19
.github/workflows/portlabel.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Port Request Labeler
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- release/**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release_labeler:
|
||||||
|
name: Release labeler
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- uses: ./build/actions/AutoLabel/dist/index.js
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
with:
|
||||||
|
label: "Port Request"
|
||||||
17
build/actions/AutoLabel/.eslintrc.json
Normal file
17
build/actions/AutoLabel/.eslintrc.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"commonjs": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
||||||
98
build/actions/AutoLabel/.gitignore
vendored
Normal file
98
build/actions/AutoLabel/.gitignore
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/node
|
||||||
|
# Edit at https://www.gitignore.io/?templates=node
|
||||||
|
|
||||||
|
### Node ###
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# react / gatsby
|
||||||
|
public/
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/node
|
||||||
9
build/actions/AutoLabel/action.yml
Normal file
9
build/actions/AutoLabel/action.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: 'Auto Labeler'
|
||||||
|
description: 'Automatically add a label to a PR'
|
||||||
|
author: 'aaomidi'
|
||||||
|
inputs:
|
||||||
|
token:
|
||||||
|
description: 'The GITHUB_TOKEN secret'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'dist/index.js'
|
||||||
1
build/actions/AutoLabel/dist/index.d.ts
vendored
Normal file
1
build/actions/AutoLabel/dist/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
35714
build/actions/AutoLabel/dist/index.js
vendored
Normal file
35714
build/actions/AutoLabel/dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
build/actions/AutoLabel/package.json
Normal file
24
build/actions/AutoLabel/package.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "auto-merge",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"repository": "git@github.com:aaomidi/AutoLabel.git",
|
||||||
|
"author": "Amir Omidi <amir@aaomidi.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"package": "ncc build src/index.ts -o dist",
|
||||||
|
"lint": "eslint src/index.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.11.1",
|
||||||
|
"@zeit/ncc": "^0.21.1",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.1.3",
|
||||||
|
"@actions/github": "^1.1.0",
|
||||||
|
"@octokit/rest": "^16.33.1",
|
||||||
|
"actions-toolkit": "^3.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
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();
|
||||||
76
build/actions/AutoLabel/tsconfig.json
Normal file
76
build/actions/AutoLabel/tsconfig.json
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Basic Options */
|
||||||
|
"target": "es6",
|
||||||
|
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||||
|
"module": "commonjs",
|
||||||
|
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
"declaration": true,
|
||||||
|
/* Generates corresponding '.d.ts' file. */
|
||||||
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
"sourceMap": true,
|
||||||
|
/* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
"outDir": "out",
|
||||||
|
/* Redirect output structure to the directory. */
|
||||||
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true,
|
||||||
|
/* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
"strictNullChecks": true,
|
||||||
|
/* Enable strict null checks. */
|
||||||
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
"alwaysStrict": true,
|
||||||
|
/* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
|
||||||
|
/* Module Resolution Options */
|
||||||
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
|
"types": ["node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
/* Type declaration files to be included in compilation. */
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
/* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./src/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
1405
build/actions/AutoLabel/yarn.lock
Normal file
1405
build/actions/AutoLabel/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
17
build/actions/AutoMerge/.eslintrc.json
Normal file
17
build/actions/AutoMerge/.eslintrc.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"commonjs": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
||||||
100
build/actions/AutoMerge/.gitignore
vendored
Normal file
100
build/actions/AutoMerge/.gitignore
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/node
|
||||||
|
# Edit at https://www.gitignore.io/?templates=node
|
||||||
|
|
||||||
|
### Node ###
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# react / gatsby
|
||||||
|
public/
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/node
|
||||||
|
|
||||||
|
out/
|
||||||
6
build/actions/AutoMerge/action.yml
Normal file
6
build/actions/AutoMerge/action.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: 'Auto Merge'
|
||||||
|
description: 'Automatically merges a PR based on command'
|
||||||
|
author: 'aaomidi'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'dist/index.js'
|
||||||
1
build/actions/AutoMerge/dist/index.d.ts
vendored
Normal file
1
build/actions/AutoMerge/dist/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
35769
build/actions/AutoMerge/dist/index.js
vendored
Normal file
35769
build/actions/AutoMerge/dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
build/actions/AutoMerge/package.json
Normal file
24
build/actions/AutoMerge/package.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "auto-merge",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"repository": "git@github.com:aaomidi/AutoMerge.git",
|
||||||
|
"author": "Amir Omidi <amir@aaomidi.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"package": "ncc build src/index.ts -o dist",
|
||||||
|
"lint": "eslint src/index.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.11.1",
|
||||||
|
"@zeit/ncc": "^0.21.1",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.1.3",
|
||||||
|
"@actions/github": "^1.1.0",
|
||||||
|
"@octokit/rest": "^16.33.1",
|
||||||
|
"actions-toolkit": "^3.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
134
build/actions/AutoMerge/src/index.ts
Normal file
134
build/actions/AutoMerge/src/index.ts
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
import { Octokit } from '@octokit/rest';
|
||||||
|
|
||||||
|
interface LabelDefinition {
|
||||||
|
id: number,
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RepoContext {
|
||||||
|
repo: string,
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const tools = new Toolkit({
|
||||||
|
event: 'issue_comment',
|
||||||
|
secrets: ['GITHUB_TOKEN']
|
||||||
|
});
|
||||||
|
|
||||||
|
const labelToCheckFor = tools.inputs.label || 'Approved';
|
||||||
|
|
||||||
|
const fileToCheckFor = tools.inputs.filePath || './.github/mergers.json';
|
||||||
|
|
||||||
|
const checkMerged = async (repoContext: RepoContext, pullNumber: number): Promise<boolean> => {
|
||||||
|
let isMerged: boolean;
|
||||||
|
try {
|
||||||
|
const result = await tools.github.pulls.checkIfMerged({
|
||||||
|
...repoContext,
|
||||||
|
pull_number: pullNumber
|
||||||
|
});
|
||||||
|
isMerged = result.status === 204;
|
||||||
|
} catch (ex) {
|
||||||
|
isMerged = false;
|
||||||
|
}
|
||||||
|
return isMerged;
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkCollabrator = async (repoContext: RepoContext, username: string): Promise<boolean> => {
|
||||||
|
let isCollabrator: boolean;
|
||||||
|
try {
|
||||||
|
const result = await tools.github.repos.checkCollaborator({
|
||||||
|
...repoContext,
|
||||||
|
username,
|
||||||
|
});
|
||||||
|
isCollabrator = result.status === 204;
|
||||||
|
} catch (ex) {
|
||||||
|
isCollabrator = false;
|
||||||
|
}
|
||||||
|
return isCollabrator;
|
||||||
|
};
|
||||||
|
|
||||||
|
tools.command('merge', async () => {
|
||||||
|
try {
|
||||||
|
const issue = tools.context.payload.issue;
|
||||||
|
|
||||||
|
if (issue?.pull_request === undefined) {
|
||||||
|
console.log('This command only works on pull requests');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sender = tools.context.payload.sender;
|
||||||
|
|
||||||
|
const senderName = sender?.login ?? ' Unknown Sender';
|
||||||
|
const issueNumber = issue?.number;
|
||||||
|
|
||||||
|
if (!issueNumber) {
|
||||||
|
return tools.log.error('Issue number not defined.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const isMerged = await checkMerged(tools.context.repo, issueNumber);
|
||||||
|
|
||||||
|
if (isMerged === true) {
|
||||||
|
console.log('PR is already merged');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mergers: string[] = JSON.parse(tools.getFile(fileToCheckFor));
|
||||||
|
|
||||||
|
if (!mergers.includes(senderName)) {
|
||||||
|
console.log('Unrecognized user tried to merge!', senderName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isCollabrator = await checkCollabrator(tools.context.repo, senderName);
|
||||||
|
|
||||||
|
if (isCollabrator !== true) {
|
||||||
|
console.log('User is not a collabrator');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const labels: LabelDefinition[] = issue.labels || [];
|
||||||
|
|
||||||
|
const foundLabel = labels.find(l => l.name === labelToCheckFor);
|
||||||
|
|
||||||
|
if (foundLabel === undefined) {
|
||||||
|
console.log(`Label ${labelToCheckFor} must be applied`);
|
||||||
|
const createCommentParams: Octokit.IssuesCreateCommentParams = {
|
||||||
|
...tools.context.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body: `The label ${labelToCheckFor} is required for using this command.`
|
||||||
|
};
|
||||||
|
await tools.github.issues.createComment(createCommentParams);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createCommentParams: Octokit.IssuesCreateCommentParams = {
|
||||||
|
...tools.context.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body: `Merging PR based on approval from @${senderName}`
|
||||||
|
};
|
||||||
|
|
||||||
|
const commentResult = await tools.github.issues.createComment(createCommentParams);
|
||||||
|
|
||||||
|
if (commentResult.status !== 201) {
|
||||||
|
console.log('Comment not created');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mergeResult = await tools.github.pulls.merge({
|
||||||
|
...tools.context.repo,
|
||||||
|
pull_number: issueNumber,
|
||||||
|
merge_method: 'squash'
|
||||||
|
});
|
||||||
|
console.log(mergeResult);
|
||||||
|
} catch (ex) {
|
||||||
|
console.error(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Running...');
|
||||||
76
build/actions/AutoMerge/tsconfig.json
Normal file
76
build/actions/AutoMerge/tsconfig.json
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Basic Options */
|
||||||
|
"target": "es6",
|
||||||
|
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||||
|
"module": "commonjs",
|
||||||
|
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
"declaration": true,
|
||||||
|
/* Generates corresponding '.d.ts' file. */
|
||||||
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
"sourceMap": true,
|
||||||
|
/* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
"outDir": "out",
|
||||||
|
/* Redirect output structure to the directory. */
|
||||||
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true,
|
||||||
|
/* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
"strictNullChecks": true,
|
||||||
|
/* Enable strict null checks. */
|
||||||
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
"alwaysStrict": true,
|
||||||
|
/* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
|
||||||
|
/* Module Resolution Options */
|
||||||
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
|
"types": ["node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
/* Type declaration files to be included in compilation. */
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
/* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./src/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
1405
build/actions/AutoMerge/yarn.lock
Normal file
1405
build/actions/AutoMerge/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,8 @@ const all = [
|
|||||||
'src/**/*',
|
'src/**/*',
|
||||||
'test/**/*',
|
'test/**/*',
|
||||||
'!test/**/out/**',
|
'!test/**/out/**',
|
||||||
'!**/node_modules/**'
|
'!**/node_modules/**',
|
||||||
|
'!build/actions/**/dist/*' // {{ SQL CARBON EDIT }}
|
||||||
];
|
];
|
||||||
|
|
||||||
const indentationFilter = [
|
const indentationFilter = [
|
||||||
@@ -95,6 +96,7 @@ const indentationFilter = [
|
|||||||
'!**/*.dockerfile',
|
'!**/*.dockerfile',
|
||||||
'!extensions/markdown-language-features/media/*.js',
|
'!extensions/markdown-language-features/media/*.js',
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
|
'!build/actions/**/dist/*',
|
||||||
'!**/*.{xlf,docx,sql,vsix,bacpac,ipynb}',
|
'!**/*.{xlf,docx,sql,vsix,bacpac,ipynb}',
|
||||||
'!extensions/mssql/sqltoolsservice/**',
|
'!extensions/mssql/sqltoolsservice/**',
|
||||||
'!extensions/import/flatfileimportservice/**',
|
'!extensions/import/flatfileimportservice/**',
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"**/*.ts"
|
"**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules/**"
|
"node_modules/**",
|
||||||
|
"actions/**"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user