Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure PRs are merged #1015

Merged
merged 2 commits into from Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/generate-fixtures.js
Expand Up @@ -3,7 +3,9 @@
const fs = require('fs')
const path = require('path')
const fetch = require('node-fetch')
const dotenv = require('dotenv')
const { findCommitsWithAssociatedPullRequestsQuery } = require('../lib/commits')
dotenv.config()

const REPO_NAME = 'release-drafter-test-repo'
const GITHUB_GRAPHQL_API_ENDPOINT = 'https://api.github.com/graphql'
Expand Down Expand Up @@ -53,6 +55,8 @@ for (const repo of repos) {
ref: repo.branch,
withPullRequestBody: true,
withPullRequestURL: true,
withBaseRefName: true,
withHeadRefName: true,
},
}),
}
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Expand Up @@ -133128,6 +133128,7 @@ const findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
name
}
}
merged
baseRefName @include(if: $withBaseRefName)
headRefName @include(if: $withHeadRefName)
}
Expand Down Expand Up @@ -133192,7 +133193,9 @@ const findCommitsWithAssociatedPullRequests = async ({
const pullRequests = _.uniqBy(
commits.flatMap((commit) => commit.associatedPullRequests.nodes),
'number'
).filter((pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner)
).filter(
(pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner && pr.merged
)

return { commits, pullRequests }
}
Expand Down
5 changes: 4 additions & 1 deletion lib/commits.js
Expand Up @@ -52,6 +52,7 @@ const findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
name
}
}
merged
baseRefName @include(if: $withBaseRefName)
headRefName @include(if: $withHeadRefName)
}
Expand Down Expand Up @@ -116,7 +117,9 @@ const findCommitsWithAssociatedPullRequests = async ({
const pullRequests = _.uniqBy(
commits.flatMap((commit) => commit.associatedPullRequests.nodes),
'number'
).filter((pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner)
).filter(
(pr) => pr.baseRepository.nameWithOwner === repoNameWithOwner && pr.merged
)

return { commits, pullRequests }
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"mocked-env": "^1.3.5",
"nock": "13.2.2",
"nock-knock": "2.0.0",
"node-fetch": "3.1.0",
"node-fetch": "2.6.7",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.1.0 is an ESM module, which we cannot use yet.

"nodemon": "2.0.15",
"prettier": "2.5.1",
"smee-client": "1.2.2"
Expand Down
90 changes: 72 additions & 18 deletions test/fixtures/__generated__/graphql-commits-forking.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.