mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
refactor: drop pr.isStale (#6826)
This commit is contained in:
@@ -1866,7 +1866,6 @@ Object {
|
||||
"full_name": "some/repo",
|
||||
},
|
||||
},
|
||||
"isStale": true,
|
||||
"number": 91,
|
||||
"sha": undefined,
|
||||
"state": "open",
|
||||
@@ -2057,17 +2056,6 @@ Array [
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/pulls/91",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/git/refs/heads/master",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -2089,7 +2077,6 @@ Object {
|
||||
"full_name": "other/repo",
|
||||
},
|
||||
},
|
||||
"isStale": true,
|
||||
"number": 90,
|
||||
"sha": undefined,
|
||||
"state": "open",
|
||||
@@ -2327,17 +2314,6 @@ Array [
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/pulls/90",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/forked/repo/git/refs/heads/master",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -3007,17 +2983,6 @@ Array [
|
||||
"method": "POST",
|
||||
"url": "https://api.github.com/graphql",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/git/refs/heads/master",
|
||||
},
|
||||
Object {
|
||||
"graphql": Object {
|
||||
"query": Object {
|
||||
@@ -3073,7 +3038,6 @@ Object {
|
||||
"hasAssignees": false,
|
||||
"hasReviewers": false,
|
||||
"isConflicted": true,
|
||||
"isStale": true,
|
||||
"number": 2500,
|
||||
"state": "open",
|
||||
"targetBranch": "master",
|
||||
@@ -3200,17 +3164,6 @@ Array [
|
||||
"method": "POST",
|
||||
"url": "https://api.github.com/graphql",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/git/refs/heads/master",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -3594,17 +3547,6 @@ Array [
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/pulls/1234",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/git/refs/heads/master",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -3617,7 +3559,6 @@ Object {
|
||||
"canMerge": true,
|
||||
"commits": 1,
|
||||
"displayNumber": "Pull Request #1",
|
||||
"isStale": true,
|
||||
"mergeable": true,
|
||||
"number": 1,
|
||||
"sha": undefined,
|
||||
@@ -3798,17 +3739,6 @@ Array [
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/pulls/1234",
|
||||
},
|
||||
Object {
|
||||
"headers": Object {
|
||||
"accept": "application/vnd.github.v3+json",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"authorization": "token abc123",
|
||||
"host": "api.github.com",
|
||||
"user-agent": "https://github.com/renovatebot/renovate",
|
||||
},
|
||||
"method": "GET",
|
||||
"url": "https://api.github.com/repos/some/repo/git/refs/heads/master",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
|
||||
@@ -491,9 +491,7 @@ describe('platform/github', () => {
|
||||
},
|
||||
head: { ref: 'somebranch', repo: { full_name: 'some/repo' } },
|
||||
state: 'open',
|
||||
})
|
||||
.get('/repos/some/repo/git/refs/heads/master')
|
||||
.reply(200, { object: { sha: '12345' } });
|
||||
});
|
||||
|
||||
await github.initRepo({
|
||||
repository: 'some/repo',
|
||||
@@ -534,8 +532,6 @@ describe('platform/github', () => {
|
||||
head: { ref: 'somebranch', repo: { full_name: 'other/repo' } },
|
||||
state: 'open',
|
||||
})
|
||||
.get('/repos/forked/repo/git/refs/heads/master')
|
||||
.reply(200, { object: { sha: '12345' } })
|
||||
.patch('/repos/forked/repo/git/refs/heads/master')
|
||||
.reply(200);
|
||||
await github.initRepo({
|
||||
@@ -1643,15 +1639,7 @@ describe('platform/github', () => {
|
||||
it('should return PR from graphql result', async () => {
|
||||
const scope = httpMock.scope(githubApiHost);
|
||||
initRepoMock(scope, 'some/repo');
|
||||
scope
|
||||
.post('/graphql')
|
||||
.reply(200, graphqlOpenPullRequests)
|
||||
.get('/repos/some/repo/git/refs/heads/master')
|
||||
.reply(200, {
|
||||
object: {
|
||||
sha: '1234123412341234123412341234123412341234',
|
||||
},
|
||||
});
|
||||
scope.post('/graphql').reply(200, graphqlOpenPullRequests);
|
||||
global.gitAuthor = {
|
||||
name: 'Renovate Bot',
|
||||
email: 'renovate@whitesourcesoftware.com',
|
||||
@@ -1672,12 +1660,7 @@ describe('platform/github', () => {
|
||||
.reply(200, graphqlOpenPullRequests)
|
||||
.post('/graphql')
|
||||
.reply(200, graphqlClosedPullRequests)
|
||||
.get('/repos/some/repo/git/refs/heads/master')
|
||||
.reply(200, {
|
||||
object: {
|
||||
sha: '1234123412341234123412341234123412341234',
|
||||
},
|
||||
});
|
||||
.get('/repos/some/repo/git/refs/heads/master');
|
||||
await github.initRepo({
|
||||
repository: 'some/repo',
|
||||
} as any);
|
||||
@@ -1735,12 +1718,6 @@ describe('platform/github', () => {
|
||||
base: { sha: '1234' },
|
||||
commits: 1,
|
||||
})
|
||||
.get('/repos/some/repo/git/refs/heads/master')
|
||||
.reply(200, {
|
||||
object: {
|
||||
sha: '1234',
|
||||
},
|
||||
})
|
||||
.post('/graphql')
|
||||
.twice()
|
||||
.reply(404);
|
||||
@@ -1764,12 +1741,6 @@ describe('platform/github', () => {
|
||||
commits: 1,
|
||||
mergeable: true,
|
||||
})
|
||||
.get('/repos/some/repo/git/refs/heads/master')
|
||||
.reply(200, {
|
||||
object: {
|
||||
sha: '1234',
|
||||
},
|
||||
})
|
||||
.post('/graphql')
|
||||
.twice()
|
||||
.reply(404);
|
||||
|
||||
@@ -681,18 +681,6 @@ async function getOpenPrs(): Promise<PrList> {
|
||||
} else {
|
||||
pr.isConflicted = false;
|
||||
}
|
||||
pr.isStale = false;
|
||||
if (pr.mergeStateStatus === 'BEHIND') {
|
||||
pr.isStale = true;
|
||||
} else {
|
||||
const baseCommitSHA = await getBaseCommitSHA();
|
||||
if (
|
||||
pr.commits?.nodes[0]?.commit?.parents?.edges?.[0]?.node?.oid !==
|
||||
baseCommitSHA
|
||||
) {
|
||||
pr.isStale = true;
|
||||
}
|
||||
}
|
||||
if (pr.labels) {
|
||||
pr.labels = pr.labels.nodes.map(
|
||||
(label: { name: string }) => label.name
|
||||
@@ -761,10 +749,6 @@ export async function getPr(prNo: number): Promise<Pr | null> {
|
||||
logger.debug({ prNo }, 'PR state is dirty so unmergeable');
|
||||
pr.isConflicted = true;
|
||||
}
|
||||
const baseCommitSHA = await getBaseCommitSHA();
|
||||
if (!pr.base || pr.base.sha !== baseCommitSHA) {
|
||||
pr.isStale = true;
|
||||
}
|
||||
}
|
||||
return pr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user