Repository: release-drafter/release-drafter
Pull request #931 (2021-08-26 10:20:31)

Include `edited` event for autolabeler
# Why

One of the input for the autolabeler is the PR title. If while creating the PR, the title didn't conform with any of the autolabeling rules, changing afterwards does not trigger the autolabeler. 

# Summary of changes

- Include the `edited` event of pull requests.


Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a6c41b4..fd33301 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -12,16 +12,16 @@ Please note that this project is released with a [Contributor Code of Conduct][c
 ## Submitting a pull request
 
 1. [Fork][fork] and clone the repository
-1. Configure and install the dependencies: `npm install`
-1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so no need to lint seperately
+1. Configure and install the dependencies: `yarn install`
+1. Make sure the tests pass on your machine: `yarn test`, note: these tests also apply the linter, so no need to lint seperately
 1. Create a new branch: `git checkout -b my-branch-name`
-1. Make your change, add tests, and make sure the tests still pass
+1. Make your change, add tests, build with `yarn prettier && yarn lint --fix && yarn build` and make sure the tests still pass
 1. Push to your fork and [submit a pull request][pr]
 1. Give yourself a high five, and wait for your pull request to be reviewed and merged.
 
 Here are a few things you can do that will increase the likelihood of your pull request being accepted:
 
-- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`
+- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `yarn test`
 - Write and update tests.
 - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
 - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
diff --git a/README.md b/README.md
index 58c0bb5..c20f491 100644
--- a/README.md
+++ b/README.md
@@ -192,13 +192,15 @@ 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`. Any characters excluding @ and # matching `change-title-escapes` will be prepended with a backslash so that they will appear verbatim instead of being interpreted as markdown format characters. @s and #s if present in `change-title-escapes` will be appended with an HTML comment so that they don't become mentions. |
-| `$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`.                                                                                                                                                                                                                                                                                                            |
+| Variable         | Description                                                                                                                                                                                                                                                                                                                                                                            |
+| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `$NUMBER`        | The number of the pull request, e.g. `42`.                                                                                                                                                                                                                                                                                                                                             |
+| `$TITLE`         | The title of the pull request, e.g. `Add alien technology`. Any characters excluding @ and # matching `change-title-escapes` will be prepended with a backslash so that they will appear verbatim instead of being interpreted as markdown format characters. @s and #s if present in `change-title-escapes` will be appended with an HTML comment so that they don't become mentions. |
+| `$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`.                                                                                                                                                                                                                                                                                                            |
+| `$BASE_REF_NAME` | The base name of of the base Ref associated with the pull request e.g. `master`.                                                                                                                                                                                                                                                                                                       |
+| `$HEAD_REF_NAME` | The head name of the head Ref associated with the pull request e.g. `my-bug-fix`.                                                                                                                                                                                                                                                                                                      |
 
 ## References
 
@@ -312,7 +314,7 @@ The Release Drafter GitHub Action accepts a number of optional inputs directly i
 | `tag`         | The tag name to be associated with the GitHub release that's created or updated. This will override any `tag-template` specified in your `release-drafter.yml` if defined.                                                                                                                                                                                         |
 | `version`     | The version to be associated with the GitHub release that's created or updated. This will override any version calculated by the release-drafter.                                                                                                                                                                                                                  |
 | `publish`     | A boolean indicating whether the release being created or updated should be immediately published. This may be useful if the output of a previous workflow step determines that a new version of your project has been (or will be) released, as with [`salsify/action-detect-and-tag-new-version`](https://github.com/salsify/action-detect-and-tag-new-version). |
-| `prerelease`  | A boolean indicating whether the relase being created or updated is a prerelease.                                                                                                                                                                                                                                                                                  |
+| `prerelease`  | A boolean indicating whether the release being created or updated is a prerelease.                                                                                                                                                                                                                                                                                  |
 | `commitish`   | A string specifying the target branch for the release being created.                                                                                                                                                                                                                                                                                               |
 
 ## Action Outputs
diff --git a/dist/index.js b/dist/index.js
index ccb1a0a..89b28a9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -41,6 +41,7 @@ module.exports = (app, { getRouter }) => {
       'pull_request.opened',
       'pull_request.reopened',
       'pull_request.synchronize',
+      'pull_request.edited',
     ],
     async (context) => {
       const { disableAutolabeler } = getInput()
@@ -283,6 +284,8 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
     $withPullRequestURL: Boolean!
     $since: GitTimestamp
     $after: String
+    $withBaseRefName: Boolean!
+    $withHeadRefName: Boolean!
   ) {
     repository(name: $name, owner: $owner) {
       object(expression: $ref) {
@@ -322,6 +325,8 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
                       name
                     }
                   }
+                  baseRefName @include(if: $withBaseRefName)
+                  headRefName @include(if: $withHeadRefName)
                 }
               }
             }
@@ -345,6 +350,8 @@ module.exports.findCommitsWithAssociatedPullRequests = async ({
     ref,
     withPullRequestBody: config['change-template'].includes('$BODY'),
     withPullRequestURL: config['change-template'].includes('$URL'),
+    withBaseRefName: config['change-template'].includes('$BASE_REF_NAME'),
+    withHeadRefName: config['change-template'].includes('$HEAD_REF_NAME'),
   }
   const dataPath = ['repository', 'object', 'history']
   const repoNameWithOwner = `${owner}/${repo}`
@@ -749,6 +756,8 @@ const generateChangeLog = (mergedPullRequests, config) => {
           $AUTHOR: pullRequest.author ? pullRequest.author.login : 'ghost',
           $BODY: pullRequest.body,
           $URL: pullRequest.url,
+          $BASE_REF_NAME: pullRequest.baseRefName,
+          $HEAD_REF_NAME: pullRequest.headRefName,
         })
       )
       .join('\n')
@@ -1298,8 +1307,53 @@ const splitSemVer = (input, versionKey = 'version') => {
 const getTemplatableVersion = (input) => {
   const templatableVersion = {
     $NEXT_MAJOR_VERSION: splitSemVer({ ...input, inc: 'major' }),
+    $NEXT_MAJOR_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$MAJOR',
+    }),
+    $NEXT_MAJOR_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$MINOR',
+    }),
+    $NEXT_MAJOR_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$PATCH',
+    }),
     $NEXT_MINOR_VERSION: splitSemVer({ ...input, inc: 'minor' }),
+    $NEXT_MINOR_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$MAJOR',
+    }),
+    $NEXT_MINOR_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$MINOR',
+    }),
+    $NEXT_MINOR_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$PATCH',
+    }),
     $NEXT_PATCH_VERSION: splitSemVer({ ...input, inc: 'patch' }),
+    $NEXT_PATCH_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$MAJOR',
+    }),
+    $NEXT_PATCH_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$MINOR',
+    }),
+    $NEXT_PATCH_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$PATCH',
+    }),
     $INPUT_VERSION: splitSemVer(input, 'inputVersion'),
     $RESOLVED_VERSION: splitSemVer({
       ...input,
diff --git a/index.js b/index.js
index 7581387..3ffe0aa 100644
--- a/index.js
+++ b/index.js
@@ -27,6 +27,7 @@ module.exports = (app, { getRouter }) => {
       'pull_request.opened',
       'pull_request.reopened',
       'pull_request.synchronize',
+      'pull_request.edited',
     ],
     async (context) => {
       const { disableAutolabeler } = getInput()
diff --git a/lib/commits.js b/lib/commits.js
index 3569cb2..2e345e3 100644
--- a/lib/commits.js
+++ b/lib/commits.js
@@ -11,6 +11,8 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
     $withPullRequestURL: Boolean!
     $since: GitTimestamp
     $after: String
+    $withBaseRefName: Boolean!
+    $withHeadRefName: Boolean!
   ) {
     repository(name: $name, owner: $owner) {
       object(expression: $ref) {
@@ -50,6 +52,8 @@ module.exports.findCommitsWithAssociatedPullRequestsQuery = /* GraphQL */ `
                       name
                     }
                   }
+                  baseRefName @include(if: $withBaseRefName)
+                  headRefName @include(if: $withHeadRefName)
                 }
               }
             }
@@ -73,6 +77,8 @@ module.exports.findCommitsWithAssociatedPullRequests = async ({
     ref,
     withPullRequestBody: config['change-template'].includes('$BODY'),
     withPullRequestURL: config['change-template'].includes('$URL'),
+    withBaseRefName: config['change-template'].includes('$BASE_REF_NAME'),
+    withHeadRefName: config['change-template'].includes('$HEAD_REF_NAME'),
   }
   const dataPath = ['repository', 'object', 'history']
   const repoNameWithOwner = `${owner}/${repo}`
diff --git a/lib/releases.js b/lib/releases.js
index fe4c73c..717c14d 100644
--- a/lib/releases.js
+++ b/lib/releases.js
@@ -186,6 +186,8 @@ const generateChangeLog = (mergedPullRequests, config) => {
           $AUTHOR: pullRequest.author ? pullRequest.author.login : 'ghost',
           $BODY: pullRequest.body,
           $URL: pullRequest.url,
+          $BASE_REF_NAME: pullRequest.baseRefName,
+          $HEAD_REF_NAME: pullRequest.headRefName,
         })
       )
       .join('\n')
diff --git a/lib/versions.js b/lib/versions.js
index 157551f..7346d70 100644
--- a/lib/versions.js
+++ b/lib/versions.js
@@ -21,8 +21,53 @@ const splitSemVer = (input, versionKey = 'version') => {
 const getTemplatableVersion = (input) => {
   const templatableVersion = {
     $NEXT_MAJOR_VERSION: splitSemVer({ ...input, inc: 'major' }),
+    $NEXT_MAJOR_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$MAJOR',
+    }),
+    $NEXT_MAJOR_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$MINOR',
+    }),
+    $NEXT_MAJOR_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'major',
+      template: '$PATCH',
+    }),
     $NEXT_MINOR_VERSION: splitSemVer({ ...input, inc: 'minor' }),
+    $NEXT_MINOR_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$MAJOR',
+    }),
+    $NEXT_MINOR_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$MINOR',
+    }),
+    $NEXT_MINOR_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'minor',
+      template: '$PATCH',
+    }),
     $NEXT_PATCH_VERSION: splitSemVer({ ...input, inc: 'patch' }),
+    $NEXT_PATCH_VERSION_MAJOR: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$MAJOR',
+    }),
+    $NEXT_PATCH_VERSION_MINOR: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$MINOR',
+    }),
+    $NEXT_PATCH_VERSION_PATCH: splitSemVer({
+      ...input,
+      inc: 'patch',
+      template: '$PATCH',
+    }),
     $INPUT_VERSION: splitSemVer(input, 'inputVersion'),
     $RESOLVED_VERSION: splitSemVer({
       ...input,


Test patch:
diff --git a/test/fixtures/config/config-with-major-minor-patch-version-template.yml b/test/fixtures/config/config-with-major-minor-patch-version-template.yml
index 2eb59b6..cae1d12 100644
--- a/test/fixtures/config/config-with-major-minor-patch-version-template.yml
+++ b/test/fixtures/config/config-with-major-minor-patch-version-template.yml
@@ -1,4 +1,4 @@
-template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION, minor=$NEXT_MINOR_VERSION, patch=$NEXT_PATCH_VERSION
+template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION (major=$NEXT_MAJOR_VERSION_MAJOR, minor=$NEXT_MAJOR_VERSION_MINOR, patch=$NEXT_MAJOR_VERSION_PATCH), minor=$NEXT_MINOR_VERSION (major=$NEXT_MINOR_VERSION_MAJOR, minor=$NEXT_MINOR_VERSION_MINOR, patch=$NEXT_MINOR_VERSION_PATCH), patch=$NEXT_PATCH_VERSION (major=$NEXT_PATCH_VERSION_MAJOR, minor=$NEXT_PATCH_VERSION_MINOR, patch=$NEXT_PATCH_VERSION_PATCH)
 name-template: 'v$NEXT_PATCH_VERSION (Code name: Placeholder)'
 tag-template: v$NEXT_PATCH_VERSION
 version-template: $MAJOR.$MINOR.$PATCH
diff --git a/test/fixtures/config/config-with-major-minor-version-template.yml b/test/fixtures/config/config-with-major-minor-version-template.yml
index f9a6f8b..3d6f2a2 100644
--- a/test/fixtures/config/config-with-major-minor-version-template.yml
+++ b/test/fixtures/config/config-with-major-minor-version-template.yml
@@ -1,4 +1,4 @@
-template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION, minor=$NEXT_MINOR_VERSION, patch=$NEXT_PATCH_VERSION
+template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION (major=$NEXT_MAJOR_VERSION_MAJOR, minor=$NEXT_MAJOR_VERSION_MINOR, patch=$NEXT_MAJOR_VERSION_PATCH), minor=$NEXT_MINOR_VERSION (major=$NEXT_MINOR_VERSION_MAJOR, minor=$NEXT_MINOR_VERSION_MINOR, patch=$NEXT_MINOR_VERSION_PATCH), patch=$NEXT_PATCH_VERSION (major=$NEXT_PATCH_VERSION_MAJOR, minor=$NEXT_PATCH_VERSION_MINOR, patch=$NEXT_PATCH_VERSION_PATCH)
 name-template: 'v$NEXT_MINOR_VERSION (Code name: Placeholder)'
 tag-template: v$NEXT_MINOR_VERSION
 version-template: $MAJOR.$MINOR
diff --git a/test/fixtures/config/config-with-major-version-template.yml b/test/fixtures/config/config-with-major-version-template.yml
index 2dfae7a..7e33270 100644
--- a/test/fixtures/config/config-with-major-version-template.yml
+++ b/test/fixtures/config/config-with-major-version-template.yml
@@ -1,4 +1,4 @@
-template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION, minor=$NEXT_MINOR_VERSION, patch=$NEXT_PATCH_VERSION
+template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION (major=$NEXT_MAJOR_VERSION_MAJOR, minor=$NEXT_MAJOR_VERSION_MINOR, patch=$NEXT_MAJOR_VERSION_PATCH), minor=$NEXT_MINOR_VERSION (major=$NEXT_MINOR_VERSION_MAJOR, minor=$NEXT_MINOR_VERSION_MINOR, patch=$NEXT_MINOR_VERSION_PATCH), patch=$NEXT_PATCH_VERSION (major=$NEXT_PATCH_VERSION_MAJOR, minor=$NEXT_PATCH_VERSION_MINOR, patch=$NEXT_PATCH_VERSION_PATCH)
 name-template: 'v$NEXT_MAJOR_VERSION (Code name: Placeholder)'
 tag-template: v$NEXT_MAJOR_VERSION
 version-template: $MAJOR
diff --git a/test/fixtures/config/config-with-next-versioning.yml b/test/fixtures/config/config-with-next-versioning.yml
index 769f1e7..addab34 100644
--- a/test/fixtures/config/config-with-next-versioning.yml
+++ b/test/fixtures/config/config-with-next-versioning.yml
@@ -1,3 +1,3 @@
-template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION, minor=$NEXT_MINOR_VERSION, patch=$NEXT_PATCH_VERSION
+template: Placeholder with example. Automatically calculated values are next major=$NEXT_MAJOR_VERSION (major=$NEXT_MAJOR_VERSION_MAJOR, minor=$NEXT_MAJOR_VERSION_MINOR, patch=$NEXT_MAJOR_VERSION_PATCH), minor=$NEXT_MINOR_VERSION (major=$NEXT_MINOR_VERSION_MAJOR, minor=$NEXT_MINOR_VERSION_MINOR, patch=$NEXT_MINOR_VERSION_PATCH), patch=$NEXT_PATCH_VERSION (major=$NEXT_PATCH_VERSION_MAJOR, minor=$NEXT_PATCH_VERSION_MINOR, patch=$NEXT_PATCH_VERSION_PATCH)
 name-template: 'v$NEXT_PATCH_VERSION (Code name: Placeholder)'
 tag-template: v$NEXT_PATCH_VERSION
diff --git a/test/index.test.js b/test/index.test.js
index 6f40aa2..3771ea2 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -429,7 +429,7 @@ describe('release-drafter', () => {
             (body) => {
               expect(body).toMatchInlineSnapshot(`
                 Object {
-                  "body": "Placeholder with example. Automatically calculated values are next major=3.0.0, minor=2.1.0, patch=2.0.1",
+                  "body": "Placeholder with example. Automatically calculated values are next major=3.0.0 (major=3, minor=0, patch=0), minor=2.1.0 (major=2, minor=1, patch=0), patch=2.0.1 (major=2, minor=0, patch=1)",
                   "draft": true,
                   "name": "v2.0.1 (Code name: Placeholder)",
                   "prerelease": false,
@@ -1170,7 +1170,7 @@ describe('release-drafter', () => {
             (body) => {
               expect(body).toMatchInlineSnapshot(`
                 Object {
-                  "body": "Placeholder with example. Automatically calculated values are next major=3.0.0, minor=2.1.0, patch=2.0.1",
+                  "body": "Placeholder with example. Automatically calculated values are next major=3.0.0 (major=3, minor=0, patch=0), minor=2.1.0 (major=2, minor=1, patch=0), patch=2.0.1 (major=2, minor=0, patch=1)",
                   "draft": true,
                   "name": "v2.0.1 (Code name: Placeholder)",
                   "prerelease": false,
@@ -1214,7 +1214,7 @@ describe('release-drafter', () => {
             (body) => {
               expect(body).toMatchInlineSnapshot(`
                 Object {
-                  "body": "Placeholder with example. Automatically calculated values are next major=3.0, minor=2.1, patch=2.0",
+                  "body": "Placeholder with example. Automatically calculated values are next major=3.0 (major=3, minor=0, patch=0), minor=2.1 (major=2, minor=1, patch=0), patch=2.0 (major=2, minor=0, patch=1)",
                   "draft": true,
                   "name": "v2.1 (Code name: Placeholder)",
                   "prerelease": false,
@@ -1258,7 +1258,7 @@ describe('release-drafter', () => {
             (body) => {
               expect(body).toMatchInlineSnapshot(`
                 Object {
-                  "body": "Placeholder with example. Automatically calculated values are next major=3, minor=2, patch=2",
+                  "body": "Placeholder with example. Automatically calculated values are next major=3 (major=3, minor=0, patch=0), minor=2 (major=2, minor=1, patch=0), patch=2 (major=2, minor=0, patch=1)",
                   "draft": true,
                   "name": "v3 (Code name: Placeholder)",
                   "prerelease": false,
diff --git a/test/releases.test.js b/test/releases.test.js
index 27576df..4353607 100644
--- a/test/releases.test.js
+++ b/test/releases.test.js
@@ -8,6 +8,8 @@ const pullRequests = [
     body: 'A1 body',
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bug' }] },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: 'B2',
@@ -15,6 +17,8 @@ const pullRequests = [
     body: 'B2 body',
     url: 'https://github.com',
     labels: { nodes: [{ name: 'feature' }] },
+    baseRefName: 'master',
+    headRefName: 'implement-feature',
   },
   {
     title: 'Adds missing <example>',
@@ -23,6 +27,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bug' }] },
     author: { login: 'jetersen' },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: '`#code_block`',
@@ -31,6 +37,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bug' }] },
     author: { login: 'jetersen' },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: 'Fixes #4',
@@ -39,6 +47,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bug' }] },
     author: { login: 'Happypig375' },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: '2*2 should equal to 4*1',
@@ -47,6 +57,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bug' }] },
     author: { login: 'jetersen' },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: 'Rename __confgs\\confg.yml to __configs\\config.yml',
@@ -55,6 +67,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'bugfix' }] },
     author: { login: 'ghost' },
+    baseRefName: 'master',
+    headRefName: 'fix-bug',
   },
   {
     title: 'Adds @nullable annotations to the 1*1+2*4 test in `tests.java`',
@@ -63,6 +77,8 @@ const pullRequests = [
     url: 'https://github.com',
     labels: { nodes: [{ name: 'feature' }] },
     author: { login: 'Happypig375' },
+    baseRefName: 'master',
+    headRefName: 'implement-feature',
   },
 ]
 const baseConfig = {
diff --git a/test/versions.test.js b/test/versions.test.js
index c7a18b2..1261f10 100644
--- a/test/versions.test.js
+++ b/test/versions.test.js
@@ -3,47 +3,167 @@ const each = require('jest-each').default
 
 describe('versions', () => {
   it('extracts a version-like string from the last tag', () => {
-    const versionInfo = getVersionInfo({
-      tag_name: 'v10.0.3',
-      name: 'Some release',
-    })
+    const versionInfo = getVersionInfo(
+      {
+        tag_name: 'v10.0.3',
+        name: 'Some release',
+      },
+      '$MAJOR.$MINOR.$PATCH'
+    )
 
     expect(versionInfo.$NEXT_MAJOR_VERSION.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_MINOR_VERSION.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.template).toEqual('$PATCH')
   })
 
   it('extracts a version-like string from the last release name if the tag isnt a version', () => {
-    const versionInfo = getVersionInfo({
-      tag_name: 'notaproperversion',
-      name: '10.0.3',
-    })
+    const versionInfo = getVersionInfo(
+      {
+        tag_name: 'notaproperversion',
+        name: '10.0.3',
+      },
+      '$MAJOR.$MINOR.$PATCH'
+    )
 
     expect(versionInfo.$NEXT_MAJOR_VERSION.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_MINOR_VERSION.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.template).toEqual('$PATCH')
   })
 
   it('preferences tags over release names', () => {
-    const versionInfo = getVersionInfo({
-      tag_name: '10.0.3',
-      name: '8.1.0',
-    })
+    const versionInfo = getVersionInfo(
+      {
+        tag_name: '10.0.3',
+        name: '8.1.0',
+      },
+      '$MAJOR.$MINOR.$PATCH'
+    )
 
     expect(versionInfo.$NEXT_MAJOR_VERSION.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_MINOR_VERSION.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.template).toEqual('$PATCH')
   })
 
   it('handles alpha/beta releases', () => {
-    const versionInfo = getVersionInfo({
-      tag_name: 'v10.0.3-alpha',
-      name: 'Some release',
-    })
+    const versionInfo = getVersionInfo(
+      {
+        tag_name: 'v10.0.3-alpha',
+        name: 'Some release',
+      },
+      '$MAJOR.$MINOR.$PATCH'
+    )
 
     expect(versionInfo.$NEXT_MAJOR_VERSION.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.version).toEqual('11.0.0')
+    expect(versionInfo.$NEXT_MAJOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_MINOR_VERSION.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.version).toEqual('10.1.0')
+    expect(versionInfo.$NEXT_MINOR_VERSION_PATCH.template).toEqual('$PATCH')
     expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION.template).toEqual(
+      '$MAJOR.$MINOR.$PATCH'
+    )
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MAJOR.template).toEqual('$MAJOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_MINOR.template).toEqual('$MINOR')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.version).toEqual('10.0.4')
+    expect(versionInfo.$NEXT_PATCH_VERSION_PATCH.template).toEqual('$PATCH')
   })
 
   it('returns undefined if no version was found in tag or name', () => {