fix
This commit is contained in:
+13
-5
@@ -188,7 +188,7 @@ function compare({ owner, repo, baseRef, headRef }) {
|
|||||||
let snapshot_warnings = '';
|
let snapshot_warnings = '';
|
||||||
const changes = yield octo.paginate({
|
const changes = yield octo.paginate({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/repos/{owner}/{repo}/dependency-graph/compare/{basehead}',
|
url: '/repos/{owner}/{repo}/dependency-graph/compare/{basehead}?includes_dependency_snapshots=true',
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
basehead: `${baseRef}...${headRef}`
|
basehead: `${baseRef}...${headRef}`
|
||||||
@@ -486,7 +486,9 @@ const git_refs_1 = __nccwpck_require__(1086);
|
|||||||
const utils_1 = __nccwpck_require__(918);
|
const utils_1 = __nccwpck_require__(918);
|
||||||
const comment_pr_1 = __nccwpck_require__(5842);
|
const comment_pr_1 = __nccwpck_require__(5842);
|
||||||
function delay(ms) {
|
function delay(ms) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@@ -495,23 +497,29 @@ function run() {
|
|||||||
const refs = (0, git_refs_1.getRefs)(config, github.context);
|
const refs = (0, git_refs_1.getRefs)(config, github.context);
|
||||||
let changes;
|
let changes;
|
||||||
let snapshot_warnings;
|
let snapshot_warnings;
|
||||||
for (let i = 0; i < 60 * 5; i++) {
|
let i = 0;
|
||||||
|
while (true) {
|
||||||
const comparison = yield dependencyGraph.compare({
|
const comparison = yield dependencyGraph.compare({
|
||||||
owner: github.context.repo.owner,
|
owner: github.context.repo.owner,
|
||||||
repo: github.context.repo.repo,
|
repo: github.context.repo.repo,
|
||||||
baseRef: refs.base,
|
baseRef: refs.base,
|
||||||
headRef: refs.head
|
headRef: refs.head
|
||||||
});
|
});
|
||||||
if (comparison.snapshot_warnings.match(/No snapshots were found for the head SHA/i)) {
|
if (i >= 12) {
|
||||||
|
core.setFailed('Exhausted retries. Exiting.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (comparison.snapshot_warnings.trim() !== '') {
|
||||||
core.info(comparison.snapshot_warnings);
|
core.info(comparison.snapshot_warnings);
|
||||||
core.info('Retrying in 1 second...');
|
core.info('Retrying in 10 seconds...');
|
||||||
yield delay(1000);
|
yield delay(10000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
changes = comparison.changes;
|
changes = comparison.changes;
|
||||||
snapshot_warnings = comparison.snapshot_warnings;
|
snapshot_warnings = comparison.snapshot_warnings;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
if (!changes) {
|
if (!changes) {
|
||||||
core.info('No Dependency Changes found. Skipping Dependency Review.');
|
core.info('No Dependency Changes found. Skipping Dependency Review.');
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -17,7 +17,7 @@ import {getRefs} from './git-refs'
|
|||||||
import {groupDependenciesByManifest} from './utils'
|
import {groupDependenciesByManifest} from './utils'
|
||||||
import {commentPr} from './comment-pr'
|
import {commentPr} from './comment-pr'
|
||||||
|
|
||||||
function delay(ms: number): Promise<void> {
|
async function delay(ms: number): Promise<void> {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ async function run(): Promise<void> {
|
|||||||
if (i >= 12) {
|
if (i >= 12) {
|
||||||
core.setFailed('Exhausted retries. Exiting.')
|
core.setFailed('Exhausted retries. Exiting.')
|
||||||
return
|
return
|
||||||
} else if (comparison.snapshot_warnings.trim() != '') {
|
} else if (comparison.snapshot_warnings.trim() !== '') {
|
||||||
core.info(comparison.snapshot_warnings)
|
core.info(comparison.snapshot_warnings)
|
||||||
core.info('Retrying in 10 seconds...')
|
core.info('Retrying in 10 seconds...')
|
||||||
await delay(10000)
|
await delay(10000)
|
||||||
|
|||||||
Reference in New Issue
Block a user