newrelic 7.1.3 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +72 -0
- package/THIRD_PARTY_NOTICES.md +33 -2
- package/bin/test-naming-rules.js +4 -4
- package/lib/collector/facts.js +22 -8
- package/lib/collector/http-agents.js +20 -7
- package/lib/collector/remote-method.js +18 -4
- package/lib/config/index.js +34 -42
- package/lib/feature_flags.js +6 -2
- package/lib/grpc/connection.js +39 -15
- package/lib/instrumentation/core/async_hooks.js +106 -14
- package/lib/instrumentation/core/http.js +5 -0
- package/lib/shim/shim.js +6 -1
- package/lib/spans/create-span-event-aggregator.js +1 -0
- package/lib/spans/span-event.js +6 -3
- package/lib/spans/streaming-span-event.js +6 -3
- package/lib/transaction/index.js +29 -0
- package/newrelic.js +1 -1
- package/package.json +19 -6
- package/CONTRIBUTING.md +0 -135
- package/Migration Guide.md +0 -271
- package/ROADMAP_Node.md +0 -24
- package/SECURITY.md +0 -5
- package/THIRD_PARTY_NOTICES_ADDENDUM.md +0 -213
- package/bin/ca-gen.js +0 -91
- package/bin/cassandra-setup.sh +0 -11
- package/bin/check-workflow-run.js +0 -74
- package/bin/clean.sh +0 -18
- package/bin/compare-bench-results.js +0 -172
- package/bin/create-github-release.js +0 -109
- package/bin/create-release-tag.js +0 -95
- package/bin/docker-env-vars.sh +0 -15
- package/bin/docker-services.sh +0 -49
- package/bin/git-commands.js +0 -110
- package/bin/github.js +0 -144
- package/bin/npm-commands.js +0 -31
- package/bin/prepare-release.js +0 -359
- package/bin/publish-docs.sh +0 -16
- package/bin/run-bench.js +0 -137
- package/bin/run-versioned-tests.sh +0 -24
- package/bin/smoke.sh +0 -8
- package/bin/ssl.sh +0 -87
- package/bin/update-ca-bundle.sh +0 -20
- package/bin/update-cats.sh +0 -8
- package/jsdoc-conf.json +0 -18
- package/third_party_manifest.json +0 -619
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const {program} = require('commander')
|
|
5
|
-
|
|
6
|
-
const Github = require('./github')
|
|
7
|
-
const { indexOf } = require('benchmark')
|
|
8
|
-
|
|
9
|
-
const DEFAULT_FILE_NAME = 'NEWS.md'
|
|
10
|
-
/** e.g. v7.2.1 */
|
|
11
|
-
const TAG_VALID_REGEX = /v\d+\.\d+\.\d+/
|
|
12
|
-
|
|
13
|
-
program.requiredOption('--tag <tag>', 'tag name to create GitHub release for')
|
|
14
|
-
program.option('--repo-owner <repoOwner>', 'repository owner', 'newrelic')
|
|
15
|
-
program.option('--release-notes-file <releaseNotesFile>', 'path to release notes file', DEFAULT_FILE_NAME)
|
|
16
|
-
program.option('-f --force', 'bypass validation')
|
|
17
|
-
|
|
18
|
-
async function createRelease() {
|
|
19
|
-
// Parse commandline options inputs
|
|
20
|
-
program.parse()
|
|
21
|
-
|
|
22
|
-
const options = program.opts()
|
|
23
|
-
|
|
24
|
-
console.log('Script running with following options: ', JSON.stringify(options))
|
|
25
|
-
|
|
26
|
-
const github = new Github(options.repoOwner)
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const tagName = options.tag.replace('refs/tags/', '')
|
|
30
|
-
console.log('Using tag name: ', tagName)
|
|
31
|
-
|
|
32
|
-
logStep('Validation')
|
|
33
|
-
if (options.force) {
|
|
34
|
-
console.log('--force set. Skipping validation logic')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!options.force && !TAG_VALID_REGEX.exec(tagName)) {
|
|
38
|
-
console.log('Tag arg invalid (%s). Valid tags in form: v#.#.# (e.g. v7.2.1)', tagName)
|
|
39
|
-
stopOnError()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
logStep('Get Release Notes from File')
|
|
43
|
-
const body = await getReleaseNotes(tagName, options.releaseNotesFile)
|
|
44
|
-
|
|
45
|
-
logStep('Create Release')
|
|
46
|
-
await github.createRelease(tagName, tagName, body)
|
|
47
|
-
|
|
48
|
-
console.log('*** Full Run Successful ***')
|
|
49
|
-
} catch (err) {
|
|
50
|
-
if (err.status && err.status === 404) {
|
|
51
|
-
console.log('404 status error detected. For octokit, this may mean insuffient permissions.')
|
|
52
|
-
console.log('Ensure you have a valid GITHUB_TOKEN set in your env vars.')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
stopOnError(err)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function getReleaseNotes(tagName, releaseNotesFile) {
|
|
60
|
-
console.log('Retrieving release notes from file: ', releaseNotesFile)
|
|
61
|
-
|
|
62
|
-
const data = await readReleaseNoteFile(releaseNotesFile)
|
|
63
|
-
|
|
64
|
-
const currentVersionHeader = `### ${tagName}`
|
|
65
|
-
if (data.indexOf(currentVersionHeader) !== 0) {
|
|
66
|
-
throw new Error(`Current tag (${currentVersionHeader}) not first line of release notes.`)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const sections = data.split('### ', 2)
|
|
70
|
-
if (sections.length !== 2) {
|
|
71
|
-
throw new Error('Did not split into multiple sections. Double check notes format.')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const tagSection = sections[1]
|
|
75
|
-
// e.g. v7.1.2 (2021-02-24)\n\n
|
|
76
|
-
const headingRegex = /^v\d+\.\d+\.\d+ \(\d{4}-\d{2}-\d{2}\)\n\n/
|
|
77
|
-
const headingRemoved = tagSection.replace(headingRegex, '')
|
|
78
|
-
|
|
79
|
-
return headingRemoved
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function readReleaseNoteFile(file) {
|
|
83
|
-
const promise = new Promise((resolve, reject) => {
|
|
84
|
-
fs.readFile(file, 'utf8', function (err, data) {
|
|
85
|
-
if (err) {
|
|
86
|
-
return reject(err)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
resolve(data)
|
|
90
|
-
})
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
return promise
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function stopOnError(err) {
|
|
97
|
-
if (err) {
|
|
98
|
-
console.error(err)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
console.log('Halting execution with exit code: 1')
|
|
102
|
-
process.exit(1)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function logStep(step) {
|
|
106
|
-
console.log(`\n ----- [Step]: ${step} -----\n`)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
createRelease()
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {program} = require('commander')
|
|
4
|
-
|
|
5
|
-
const checkWorkflowRun = require('./check-workflow-run')
|
|
6
|
-
const git = require('./git-commands')
|
|
7
|
-
|
|
8
|
-
// Add command line options
|
|
9
|
-
program.option('-b, --branch <branch>', 'release branch', 'main')
|
|
10
|
-
program.option('-o, --repo-owner <repoOwner>', 'repository owner', 'newrelic')
|
|
11
|
-
program.option('-f --force', 'bypass validation')
|
|
12
|
-
|
|
13
|
-
async function createReleaseTag() {
|
|
14
|
-
// Parse commandline options inputs
|
|
15
|
-
program.parse()
|
|
16
|
-
|
|
17
|
-
const options = program.opts()
|
|
18
|
-
|
|
19
|
-
console.log('Script running with following options: ', JSON.stringify(options))
|
|
20
|
-
|
|
21
|
-
const branch = options.branch.replace('refs/heads/', '')
|
|
22
|
-
const repoOwner = options.repoOwner
|
|
23
|
-
|
|
24
|
-
if (options.force) {
|
|
25
|
-
console.log('--force set. Skipping validation logic')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const isValid = options.force || (
|
|
30
|
-
await validateLocalChanges() &&
|
|
31
|
-
await validateCurrentBranch(branch) &&
|
|
32
|
-
await checkWorkflowRun(repoOwner, branch)
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
if (!isValid) {
|
|
36
|
-
process.exit(1)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const packagePath = '../package.json'
|
|
40
|
-
console.log('Extracting new version from package.json here: ', )
|
|
41
|
-
const packageInfo = require(packagePath)
|
|
42
|
-
|
|
43
|
-
const version = `v${packageInfo.version}`
|
|
44
|
-
console.log('New version is: ', version)
|
|
45
|
-
|
|
46
|
-
console.log('Creating and pushing tag')
|
|
47
|
-
|
|
48
|
-
await git.createAnnotatedTag(version, version)
|
|
49
|
-
await git.pushTags()
|
|
50
|
-
|
|
51
|
-
console.log('*** Full Run Successful ***')
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.log(err)
|
|
54
|
-
|
|
55
|
-
process.exit(1)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function validateLocalChanges() {
|
|
60
|
-
try {
|
|
61
|
-
const localChanges = await git.getLocalChanges()
|
|
62
|
-
if (localChanges.length > 0) {
|
|
63
|
-
console.log('Local changes detected: ', localChanges)
|
|
64
|
-
console.log('Please commit to a feature branch or stash changes and then try again.')
|
|
65
|
-
return false
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return true
|
|
69
|
-
} catch (err) {
|
|
70
|
-
console.error(err)
|
|
71
|
-
return false
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function validateCurrentBranch(branch) {
|
|
76
|
-
try {
|
|
77
|
-
const currentBranch = await git.getCurrentBranch()
|
|
78
|
-
|
|
79
|
-
if (branch != currentBranch) {
|
|
80
|
-
console.log(
|
|
81
|
-
'Current checked-out branch (%s) does not match expected (%s)',
|
|
82
|
-
currentBranch,
|
|
83
|
-
branch
|
|
84
|
-
)
|
|
85
|
-
return false
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return true
|
|
89
|
-
} catch (err) {
|
|
90
|
-
console.error(err)
|
|
91
|
-
return false
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
createReleaseTag()
|
package/bin/docker-env-vars.sh
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
IP=`docker-machine ip default 2>/dev/null`
|
|
7
|
-
|
|
8
|
-
export NR_NODE_TEST_CASSANDRA_HOST=$IP
|
|
9
|
-
export NR_NODE_TEST_MEMCACHED_HOST=$IP
|
|
10
|
-
export NR_NODE_TEST_MONGODB_HOST=$IP
|
|
11
|
-
export NR_NODE_TEST_MYSQL_HOST=$IP
|
|
12
|
-
export NR_NODE_TEST_ORACLE_HOST=$IP
|
|
13
|
-
export NR_NODE_TEST_POSTGRES_HOST=$IP
|
|
14
|
-
export NR_NODE_TEST_REDIS_HOST=$IP
|
|
15
|
-
export NR_NODE_TEST_RABBIT_HOST=$IP
|
package/bin/docker-services.sh
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
|
|
3
|
-
# Copyright 2020 New Relic Corporation. All rights reserved.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
-
if docker ps -a | grep -q "nr_node_memcached"; then
|
|
7
|
-
docker start nr_node_memcached;
|
|
8
|
-
else
|
|
9
|
-
docker run -d --name nr_node_memcached -p 11211:11211 memcached;
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
if docker ps -a | grep -q "nr_node_mongodb"; then
|
|
13
|
-
docker start nr_node_mongodb;
|
|
14
|
-
else
|
|
15
|
-
docker run -d --name nr_node_mongodb -p 27017:27017 library/mongo:2;
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
if docker ps -a | grep -q "nr_node_mysql"; then
|
|
19
|
-
docker start nr_node_mysql;
|
|
20
|
-
else
|
|
21
|
-
docker run -d --name nr_node_mysql \
|
|
22
|
-
-e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" \
|
|
23
|
-
-e "MYSQL_ROOT_PASSWORD=" \
|
|
24
|
-
-p 3306:3306 mysql:5;
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
if docker ps -a | grep -q "nr_node_redis"; then
|
|
28
|
-
docker start nr_node_redis;
|
|
29
|
-
else
|
|
30
|
-
docker run -d --name nr_node_redis -p 6379:6379 redis;
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
if docker ps -a | grep -q "nr_node_cassandra"; then
|
|
34
|
-
docker start nr_node_cassandra;
|
|
35
|
-
else
|
|
36
|
-
docker run -d --name nr_node_cassandra -p 9042:9042 zmarcantel/cassandra;
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
if docker ps -a | grep -q "nr_node_postgres"; then
|
|
40
|
-
docker start nr_node_postgres;
|
|
41
|
-
else
|
|
42
|
-
docker run -d --name nr_node_postgres -p 5432:5432 postgres:9.2;
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
if docker ps -a | grep -q "nr_node_rabbit"; then
|
|
46
|
-
docker start nr_node_rabbit;
|
|
47
|
-
else
|
|
48
|
-
docker run -d --name nr_node_rabbit -p 5672:5672 rabbitmq:3;
|
|
49
|
-
fi
|
package/bin/git-commands.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { exec } = require('child_process')
|
|
4
|
-
|
|
5
|
-
async function getPushRemotes() {
|
|
6
|
-
const stdout = await execAsPromise('git remote -v')
|
|
7
|
-
|
|
8
|
-
const remotes = stdout.split('\n')
|
|
9
|
-
const processedRemotes = remotes.reduce((remotePairs, currentRemote) => {
|
|
10
|
-
const parts = currentRemote.split('\t')
|
|
11
|
-
if (parts.length < 2) {
|
|
12
|
-
return remotePairs
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const [name, url] = parts
|
|
16
|
-
if (url.indexOf('(push)') >= 0) {
|
|
17
|
-
remotePairs[name] = url
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return remotePairs
|
|
21
|
-
}, {})
|
|
22
|
-
|
|
23
|
-
return processedRemotes
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function getLocalChanges() {
|
|
27
|
-
const stdout = await execAsPromise('git status --short --porcelain')
|
|
28
|
-
const changes = stdout.split('\n').filter((line) => {
|
|
29
|
-
return line.length > 0
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
return changes
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function getCurrentBranch() {
|
|
36
|
-
const stdout = await execAsPromise('git branch --show-current')
|
|
37
|
-
const branch = stdout.trim()
|
|
38
|
-
|
|
39
|
-
return branch
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function checkoutNewBranch(name) {
|
|
43
|
-
const stdout = await execAsPromise(`git checkout -b ${name}`)
|
|
44
|
-
const output = stdout.trim()
|
|
45
|
-
|
|
46
|
-
return output
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function addAllFiles() {
|
|
50
|
-
const stdout = await execAsPromise(`git add .`)
|
|
51
|
-
const output = stdout.trim()
|
|
52
|
-
|
|
53
|
-
return output
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function commit(message) {
|
|
57
|
-
const stdout = await execAsPromise(`git commit -m "${message}"`)
|
|
58
|
-
const output = stdout.trim()
|
|
59
|
-
|
|
60
|
-
return output
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function pushToRemote(remote, branchName) {
|
|
64
|
-
const stdout = await execAsPromise(`git push --set-upstream ${remote} ${branchName}`)
|
|
65
|
-
const output = stdout.trim()
|
|
66
|
-
|
|
67
|
-
return output
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function createAnnotatedTag(name, message) {
|
|
71
|
-
const stdout = await execAsPromise(`git tag -a ${name} -m ${message}`)
|
|
72
|
-
const output = stdout.trim()
|
|
73
|
-
|
|
74
|
-
return output
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async function pushTags() {
|
|
78
|
-
const stdout = await execAsPromise('git push --tags')
|
|
79
|
-
const output = stdout.trim()
|
|
80
|
-
|
|
81
|
-
return output
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function execAsPromise(command) {
|
|
85
|
-
const promise = new Promise((resolve, reject) => {
|
|
86
|
-
console.log(`Executing: '${command}'`)
|
|
87
|
-
|
|
88
|
-
exec(command, (err, stdout) => {
|
|
89
|
-
if (err) {
|
|
90
|
-
return reject(err)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
resolve(stdout)
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
return promise
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
module.exports = {
|
|
101
|
-
getPushRemotes,
|
|
102
|
-
getLocalChanges,
|
|
103
|
-
getCurrentBranch,
|
|
104
|
-
checkoutNewBranch,
|
|
105
|
-
addAllFiles,
|
|
106
|
-
commit,
|
|
107
|
-
pushToRemote,
|
|
108
|
-
createAnnotatedTag,
|
|
109
|
-
pushTags
|
|
110
|
-
}
|
package/bin/github.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { Octokit } = require("@octokit/rest")
|
|
4
|
-
|
|
5
|
-
if (!process.env.GITHUB_TOKEN) {
|
|
6
|
-
console.log('GITHUB_TOKEN recommended to be set in ENV')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const octokit = new Octokit({
|
|
10
|
-
auth: process.env.GITHUB_TOKEN,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
class Github {
|
|
14
|
-
constructor(repoOwner = 'newrelic', repository = 'node-newrelic') {
|
|
15
|
-
this.repoOwner = repoOwner
|
|
16
|
-
this.repository = repository
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async getLatestRelease() {
|
|
20
|
-
const result = await octokit.repos.getLatestRelease({
|
|
21
|
-
owner: this.repoOwner,
|
|
22
|
-
repo: this.repository
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
return result.data
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async createRelease(tag, name, body) {
|
|
29
|
-
const result = await octokit.repos.createRelease({
|
|
30
|
-
owner: this.repoOwner,
|
|
31
|
-
repo: this.repository,
|
|
32
|
-
tag_name: tag,
|
|
33
|
-
name: name,
|
|
34
|
-
body: body
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
return result.data
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async getTagByName(name) {
|
|
41
|
-
const perPage = 100
|
|
42
|
-
|
|
43
|
-
let pageNum = 1
|
|
44
|
-
|
|
45
|
-
let result = null
|
|
46
|
-
do {
|
|
47
|
-
result = await octokit.repos.listTags({
|
|
48
|
-
owner: this.repoOwner,
|
|
49
|
-
repo: this.repository,
|
|
50
|
-
per_page: perPage,
|
|
51
|
-
page: pageNum
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const found = result.data.find((tag) => {
|
|
55
|
-
return tag.name === name
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
if (found) {
|
|
59
|
-
return found
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
pageNum++
|
|
63
|
-
} while (result.data.length === perPage) // there *might* be more data
|
|
64
|
-
|
|
65
|
-
return null
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async getCommit(sha) {
|
|
69
|
-
const result = await octokit.repos.getCommit({
|
|
70
|
-
owner: this.repoOwner,
|
|
71
|
-
repo: this.repository,
|
|
72
|
-
ref: sha
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
return result.data
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async getMergedPullRequestsSince(date) {
|
|
79
|
-
const perPage = 50
|
|
80
|
-
|
|
81
|
-
const comparisonDate = new Date(date)
|
|
82
|
-
|
|
83
|
-
let pageNum = 1
|
|
84
|
-
const mergedPullRequests = []
|
|
85
|
-
let result = null
|
|
86
|
-
let hadData = false
|
|
87
|
-
|
|
88
|
-
do {
|
|
89
|
-
result = await octokit.pulls.list({
|
|
90
|
-
owner: this.repoOwner,
|
|
91
|
-
repo: this.repository,
|
|
92
|
-
state: 'closed',
|
|
93
|
-
sort: 'updated',
|
|
94
|
-
direction: 'desc',
|
|
95
|
-
per_page: perPage,
|
|
96
|
-
page: pageNum
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
const mergedPrs = result.data.filter((pr) => {
|
|
100
|
-
return pr.merged_at && new Date(pr.merged_at) > comparisonDate
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
mergedPullRequests.push(...mergedPrs)
|
|
104
|
-
// Since we are going by 'updated' on query but merged on filter,
|
|
105
|
-
// there's a chance some boundaries are off. While in super extreme
|
|
106
|
-
// cases we could still miss some it is unlikely given we are grabbing
|
|
107
|
-
// large pages.
|
|
108
|
-
hadData = mergedPrs.length > 0
|
|
109
|
-
|
|
110
|
-
pageNum++
|
|
111
|
-
} while (result.data.length === perPage && hadData) // might be more in next batch
|
|
112
|
-
|
|
113
|
-
return mergedPullRequests
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async getLatestWorkflowRun(nameOrId, branch) {
|
|
117
|
-
// Appears to return in latest order.
|
|
118
|
-
const runs = await octokit.actions.listWorkflowRuns({
|
|
119
|
-
owner: this.repoOwner,
|
|
120
|
-
repo: this.repository,
|
|
121
|
-
workflow_id: nameOrId,
|
|
122
|
-
branch: branch,
|
|
123
|
-
per_page: 5
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
return runs.data.workflow_runs[0]
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async createPR(options) {
|
|
130
|
-
const {head, base, title, body, draft} = options
|
|
131
|
-
|
|
132
|
-
await octokit.pulls.create({
|
|
133
|
-
owner: this.repoOwner,
|
|
134
|
-
repo: this.repository,
|
|
135
|
-
head: head,
|
|
136
|
-
base: base,
|
|
137
|
-
title: title,
|
|
138
|
-
body: body,
|
|
139
|
-
draft: draft
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
module.exports = Github
|
package/bin/npm-commands.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { exec } = require('child_process')
|
|
4
|
-
|
|
5
|
-
async function version(typeOrVersion, shouldCommitAndTag) {
|
|
6
|
-
let command = `npm version ${typeOrVersion}`
|
|
7
|
-
|
|
8
|
-
command += shouldCommitAndTag ? '' : ' --no-git-tag-version'
|
|
9
|
-
|
|
10
|
-
await execAsPromise(command)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function execAsPromise(command) {
|
|
14
|
-
const promise = new Promise((resolve, reject) => {
|
|
15
|
-
console.log(`Executing: '${command}'`)
|
|
16
|
-
|
|
17
|
-
exec(command, (err, stdout) => {
|
|
18
|
-
if (err) {
|
|
19
|
-
return reject(err)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
resolve(stdout)
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
return promise
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = {
|
|
30
|
-
version
|
|
31
|
-
}
|