Skip to content

Commit

Permalink
Merge pull request #582 from AnchorFree/add-url-to-drafter
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen committed Jul 2, 2020
2 parents 3f1ac7c + 4660057 commit 842a9a8
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Expand Up @@ -169,12 +169,13 @@ If a pull requests is found with the label `major`/`minor`/`patch`, the correspo

You can use any of the following variables in `change-template`:

| Variable | Description |
| --------- | ----------------------------------------------------------- |
| `$NUMBER` | The number of the pull request, e.g. `42`. |
| `$TITLE` | The title of the pull request, e.g. `Add alien technology`. |
| `$AUTHOR` | The pull request author’s username, e.g. `gracehopper`. |
| `$BODY` | The body of the pull request e.g. `Fixed spelling mistake`. |
| Variable | Description |
| --------- | --------------------------------------------------------------------------- |
| `$NUMBER` | The number of the pull request, e.g. `42`. |
| `$TITLE` | The title of the pull request, e.g. `Add alien technology`. |
| `$AUTHOR` | The pull request author’s username, e.g. `gracehopper`. |
| `$BODY` | The body of the pull request e.g. `Fixed spelling mistake`. |
| `$URL` | The URL of the pull request e.g. `https://github.com/octocat/repo/pull/42`. |

## References

Expand Down
1 change: 1 addition & 0 deletions bin/generate-fixtures.js
Expand Up @@ -52,6 +52,7 @@ repos.forEach((repo) => {
name: REPO_NAME,
ref: repo.branch,
withPullRequestBody: true,
withPullRequestURL: true,
},
}),
}
Expand Down
3 changes: 3 additions & 0 deletions lib/commits.js
Expand Up @@ -8,6 +8,7 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
$owner: String!
$ref: String!
$withPullRequestBody: Boolean!
$withPullRequestURL: Boolean!
$since: GitTimestamp
$after: String
) {
Expand Down Expand Up @@ -35,6 +36,7 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
nodes {
title
number
url @include(if: $withPullRequestURL)
body @include(if: $withPullRequestBody)
author {
login
Expand Down Expand Up @@ -73,6 +75,7 @@ module.exports.findCommitsWithAssociatedPullRequests = async ({
owner,
ref,
withPullRequestBody: config['change-template'].includes('$BODY'),
withPullRequestURL: config['change-template'].includes('$URL'),
}
const dataPath = ['repository', 'ref', 'target', 'history']
const repoNameWithOwner = `${owner}/${repo}`
Expand Down
1 change: 1 addition & 0 deletions lib/releases.js
Expand Up @@ -163,6 +163,7 @@ const generateChangeLog = (mergedPullRequests, config) => {
$NUMBER: pullRequest.number,
$AUTHOR: pullRequest.author ? pullRequest.author.login : 'ghost',
$BODY: pullRequest.body,
$URL: pullRequest.url,
})
)
.join('\n')
Expand Down
18 changes: 18 additions & 0 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.

14 changes: 14 additions & 0 deletions test/fixtures/__generated__/graphql-commits-merge-commit.json

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

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

0 comments on commit 842a9a8

Please sign in to comment.