code-suggester
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -19,2 +19,3 @@ #!/usr/bin/env node | ||
const workflow_1 = require("./workflow"); | ||
const logger_1 = require("../logger"); | ||
// tslint:disable:no-unused-expression | ||
@@ -99,3 +100,9 @@ // yargs actually is a used expression. TS-lint does not detect it. | ||
*/ | ||
workflow_1.main(); | ||
workflow_1.main().catch(err => { | ||
logger_1.logger.error(err); | ||
/* eslint-disable no-process-exit */ | ||
// If just rethrow, the application exists with code 0. | ||
// Need exit code 1 to fail GitHub Actions step if the process fails. | ||
process.exit(1); | ||
}); | ||
//# sourceMappingURL=code-suggester.js.map |
@@ -5,3 +5,4 @@ import { RepoDomain } from '../types'; | ||
* Fork the GitHub owner's repository. | ||
* Returns the fork owner and fork repo if successful. Otherwise throws error. | ||
* Returns the fork owner and fork repo when the fork creation request to GitHub succeeds. | ||
* Otherwise throws error. | ||
* | ||
@@ -8,0 +9,0 @@ * If fork already exists no new fork is created, no error occurs, and the existing Fork data is returned |
@@ -20,3 +20,4 @@ "use strict"; | ||
* Fork the GitHub owner's repository. | ||
* Returns the fork owner and fork repo if successful. Otherwise throws error. | ||
* Returns the fork owner and fork repo when the fork creation request to GitHub succeeds. | ||
* Otherwise throws error. | ||
* | ||
@@ -35,7 +36,8 @@ * If fork already exists no new fork is created, no error occurs, and the existing Fork data is returned | ||
})).data; | ||
logger_1.logger.info(`Fork successfully exists on ${upstream.repo}`); | ||
return { | ||
const origin = { | ||
repo: forkedRepo.name, | ||
owner: forkedRepo.owner.login, | ||
}; | ||
logger_1.logger.info(`Create fork request was successful for ${origin.owner}/${origin.repo}`); | ||
return origin; | ||
} | ||
@@ -42,0 +44,0 @@ catch (err) { |
@@ -8,3 +8,13 @@ import { Changes, CreatePullRequestUserOptions } from './types'; | ||
* Then a Pull Request is made from that branch. | ||
* If the upstream | ||
* | ||
* Also throws error if git data from the fork is not ready in 5 minutes. | ||
* | ||
* From the docs | ||
* https://developer.github.com/v3/repos/forks/#create-a-fork | ||
* """ | ||
* Forking a Repository happens asynchronously. | ||
* You may have to wait a short period of time before you can access the git objects. | ||
* If this takes longer than 5 minutes, be sure to contact GitHub Support or GitHub Premium Support. | ||
* """ | ||
* | ||
* If changes are empty then the workflow will not run. | ||
@@ -11,0 +21,0 @@ * Rethrows an HttpError if Octokit GitHub API returns an error. HttpError Octokit access_token and client_secret headers redact all sensitive information. |
@@ -21,2 +21,3 @@ "use strict"; | ||
const default_options_handler_1 = require("./default-options-handler"); | ||
const retry = require("async-retry"); | ||
/** | ||
@@ -26,3 +27,13 @@ * Make a new GitHub Pull Request with a set of changes applied on top of primary branch HEAD. | ||
* Then a Pull Request is made from that branch. | ||
* If the upstream | ||
* | ||
* Also throws error if git data from the fork is not ready in 5 minutes. | ||
* | ||
* From the docs | ||
* https://developer.github.com/v3/repos/forks/#create-a-fork | ||
* """ | ||
* Forking a Repository happens asynchronously. | ||
* You may have to wait a short period of time before you can access the git objects. | ||
* If this takes longer than 5 minutes, be sure to contact GitHub Support or GitHub Premium Support. | ||
* """ | ||
* | ||
* If changes are empty then the workflow will not run. | ||
@@ -55,3 +66,11 @@ * Rethrows an HttpError if Octokit GitHub API returns an error. HttpError Octokit access_token and client_secret headers redact all sensitive information. | ||
}; | ||
const refHeadSha = await handler.branch(octokit, origin, upstream, originBranch.branch, gitHubConfigs.primary); | ||
const refHeadSha = await retry(async () => await handler.branch(octokit, origin, upstream, originBranch.branch, gitHubConfigs.primary), { | ||
retries: 5, | ||
factor: 2.8411, | ||
minTimeout: 3000, | ||
randomize: false, | ||
onRetry: () => { | ||
logger_1.logger.info('Retrying at a later time...'); | ||
}, | ||
}); | ||
await handler.commitAndPush(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force); | ||
@@ -58,0 +77,0 @@ const description = { |
# Changelog | ||
### [1.1.1](https://www.github.com/googleapis/code-suggester/compare/v1.1.0...v1.1.1) (2020-08-13) | ||
### Bug Fixes | ||
* **cli,action:** when process fails, make exit code 1 ([#81](https://www.github.com/googleapis/code-suggester/issues/81)) ([c1495cb](https://www.github.com/googleapis/code-suggester/commit/c1495cb5010c6df55ef91616d0a1c3e5a508ffc7)), closes [#72](https://www.github.com/googleapis/code-suggester/issues/72) | ||
* **framework-core:** retry mechanism for when forked git object isn't quite ready ([#78](https://www.github.com/googleapis/code-suggester/issues/78)) ([326145f](https://www.github.com/googleapis/code-suggester/commit/326145f138dbd50ba455175c473a58d5717aeafe)) | ||
## [1.1.0](https://www.github.com/googleapis/code-suggester/compare/v1.0.1...v1.1.0) (2020-08-07) | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "code-suggester", | ||
"description": "Library to propose code changes", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "Apache-2.0", | ||
@@ -46,2 +46,3 @@ "author": "Google LLC", | ||
"@types/yargs": "^15.0.5", | ||
"async-retry": "^1.3.1", | ||
"glob": "^7.1.6", | ||
@@ -52,2 +53,5 @@ "pino": "^6.3.2", | ||
"devDependencies": { | ||
"@microsoft/api-documenter": "^7.8.10", | ||
"@microsoft/api-extractor": "^7.8.10", | ||
"@types/async-retry": "^1.4.2", | ||
"@types/chai": "^4.2.11", | ||
@@ -75,6 +79,4 @@ "@types/mocha": "^8.0.0", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.10", | ||
"@microsoft/api-documenter": "^7.8.10", | ||
"@microsoft/api-extractor": "^7.8.10" | ||
"webpack-cli": "^3.3.10" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
102048
1251
6
26
+ Addedasync-retry@^1.3.1
+ Addedasync-retry@1.3.3(transitive)
+ Addedretry@0.13.1(transitive)