Repository: intuit/auto
Pull request #871 (2020-01-14 18:02:55)

Fix running all-contributors when not installed


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d11802ad..90e2a20f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,3 @@
-# v9.0.1 (Mon Jan 13 2020)
-
-#### 🐛  Bug Fix
-
-- `@auto-it/core`
-  - handle PR numbers that don't exist in repo/fork [#870](https://github.com/intuit/auto/pull/870) ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
-#### Authors: 1
-
-- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
----
-
 # v9.0.0 (Mon Jan 13 2020)
 
 #### 💥  Breaking Change
diff --git a/Formula/auto.rb b/Formula/auto.rb
index a399989b..56793ec4 100644
--- a/Formula/auto.rb
+++ b/Formula/auto.rb
@@ -1,8 +1,8 @@
 class Auto < Formula
   desc "Generate releases based on semantic version labels on pull requests."
   homepage "https://intuit.github.io/auto/home.html"
-  url "https://github.com/intuit/auto/releases/download/v9.0.1/auto-macos.gz"
-  sha256 "043e60ced468682fe52a4ac6dc2f5f32fbd471af3769015f1e99dd420beb0d16"
+  url "https://github.com/intuit/auto/releases/download/v9.0.0/auto-macos.gz"
+  sha256 "0459a4dec0e7e7c2addcc8813e6ecc0e19160ba7364ea400f57f600c0f96b8f1"
 
   def install
     libexec.install Dir["*"]
diff --git a/lerna.json b/lerna.json
index 354d613d..d553adbc 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
 {
-  "version": "9.0.1",
+  "version": "9.0.0",
   "npmClient": "yarn",
   "useWorkspaces": true,
   "packages": [
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 140d71b9..a6dc69ac 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -2,7 +2,7 @@
   "name": "auto",
   "bin": "dist/bin/auto.js",
   "description": "CLI tools to help facilitate semantic versioning based on GitHub PR labels",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "author": {
     "name": "Andrew Lisowski",
     "email": "lisowski54@gmail.com"
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index e1507e0c..94cf3d63 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,15 +1,3 @@
-# v9.0.1 (Mon Jan 13 2020)
-
-#### 🐛  Bug Fix
-
-- handle PR numbers that don't exist in repo/fork  ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
-#### Authors: 1
-
-- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
----
-
 # v9.0.0 (Mon Jan 13 2020)
 
 #### 🐛  Bug Fix
diff --git a/packages/core/package.json b/packages/core/package.json
index f368fe60..999c4166 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/core",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "description": "Node API for using auto.",
   "main": "dist/auto.js",
   "author": {
diff --git a/packages/core/src/release.ts b/packages/core/src/release.ts
index 02917e5d..a9fa4cef 100644
--- a/packages/core/src/release.ts
+++ b/packages/core/src/release.ts
@@ -690,11 +690,9 @@ export default class Release {
     }
 
     if (modifiedCommit.pullRequest) {
-      const [err, info] = await on(
-        this.git.getPr(modifiedCommit.pullRequest.number)
-      );
+      const info = await this.git.getPr(modifiedCommit.pullRequest.number);
 
-      if (err || !info || !info.data) {
+      if (!info || !info.data) {
         return modifiedCommit;
       }
 
diff --git a/plugins/all-contributors/package.json b/plugins/all-contributors/package.json
index a8c440dd..b92f27c0 100644
--- a/plugins/all-contributors/package.json
+++ b/plugins/all-contributors/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/all-contributors",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Automatically add contributors as changelogs are produced.",
   "author": {
diff --git a/plugins/all-contributors/src/index.ts b/plugins/all-contributors/src/index.ts
index 3a0bd70b..6b7e49bb 100644
--- a/plugins/all-contributors/src/index.ts
+++ b/plugins/all-contributors/src/index.ts
@@ -172,7 +172,7 @@ export default class AllContributorsPlugin implements IPlugin {
               auto.logger.log.info(`Adding "${username}"'s contributions...`);
 
               execSync(
-                `npx all-contributors add ${username} ${[
+                `npx all-contributors-cli add ${username} ${[
                   ...newContributions
                 ].join(',')}`,
                 { stdio: 'inherit' }
diff --git a/plugins/chrome/package.json b/plugins/chrome/package.json
index ca73f7bd..ec9488f6 100644
--- a/plugins/chrome/package.json
+++ b/plugins/chrome/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/chrome",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Chrome publishing plugin for auto",
   "author": {
diff --git a/plugins/conventional-commits/package.json b/plugins/conventional-commits/package.json
index 671827b1..e24bc8df 100644
--- a/plugins/conventional-commits/package.json
+++ b/plugins/conventional-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/conventional-commits",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Conventional commit plugin for auto",
   "author": {
diff --git a/plugins/crates/package.json b/plugins/crates/package.json
index 3fcfd4b8..fbee2504 100644
--- a/plugins/crates/package.json
+++ b/plugins/crates/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/crates",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Deploy Rust crates to crates.io",
   "author": {
diff --git a/plugins/first-time-contributor/package.json b/plugins/first-time-contributor/package.json
index 2dca18c1..547930cc 100644
--- a/plugins/first-time-contributor/package.json
+++ b/plugins/first-time-contributor/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/first-time-contributor",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Thank first time contributors for their work right in your release notes.",
   "author": {
diff --git a/plugins/git-tag/package.json b/plugins/git-tag/package.json
index 747d8c37..753bac63 100644
--- a/plugins/git-tag/package.json
+++ b/plugins/git-tag/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/git-tag",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Manage your projects version through just a git tag",
   "author": {
diff --git a/plugins/jira/package.json b/plugins/jira/package.json
index 5cf1d9f5..8b6825af 100644
--- a/plugins/jira/package.json
+++ b/plugins/jira/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/jira",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Jira plugin for auto",
   "author": {
diff --git a/plugins/maven/package.json b/plugins/maven/package.json
index 36276dc8..d120c466 100644
--- a/plugins/maven/package.json
+++ b/plugins/maven/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/maven",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Maven publishing plugin for auto",
   "author": {
diff --git a/plugins/npm/package.json b/plugins/npm/package.json
index 580839a5..3a8d090a 100644
--- a/plugins/npm/package.json
+++ b/plugins/npm/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/npm",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "NPM publishing plugin for auto",
   "author": {
diff --git a/plugins/omit-commits/package.json b/plugins/omit-commits/package.json
index 4f5671ec..654c2f1d 100644
--- a/plugins/omit-commits/package.json
+++ b/plugins/omit-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-commits",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Omit commits plugin for auto",
   "author": {
diff --git a/plugins/omit-release-notes/package.json b/plugins/omit-release-notes/package.json
index c0fa88a3..8169a1f7 100644
--- a/plugins/omit-release-notes/package.json
+++ b/plugins/omit-release-notes/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-release-notes",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Omit release notes plugin for auto",
   "author": {
diff --git a/plugins/released/package.json b/plugins/released/package.json
index d6fc9d7d..b72b54e5 100644
--- a/plugins/released/package.json
+++ b/plugins/released/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/released",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Released plugin for auto. Comments with version + extra",
   "author": {
diff --git a/plugins/s3/package.json b/plugins/s3/package.json
index 75058344..5073e31b 100644
--- a/plugins/s3/package.json
+++ b/plugins/s3/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/s3",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Post your built artifacts to s3",
   "author": {
diff --git a/plugins/slack/package.json b/plugins/slack/package.json
index 0d1a68bc..1f68cff5 100644
--- a/plugins/slack/package.json
+++ b/plugins/slack/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/slack",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Slack plugin for auto",
   "author": {
diff --git a/plugins/twitter/package.json b/plugins/twitter/package.json
index 19f5d3bf..94ab6293 100644
--- a/plugins/twitter/package.json
+++ b/plugins/twitter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/twitter",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Twitter plugin for auto",
   "author": {
diff --git a/plugins/upload-assets/package.json b/plugins/upload-assets/package.json
index fad85430..2eae2516 100644
--- a/plugins/upload-assets/package.json
+++ b/plugins/upload-assets/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/upload-assets",
-  "version": "9.0.1",
+  "version": "9.0.0",
   "main": "dist/index.js",
   "description": "Upload assets plugin for auto",
   "author": {


Test patch:
diff --git a/packages/core/src/__tests__/release.test.ts b/packages/core/src/__tests__/release.test.ts
index 98db1813..cff7b1da 100644
--- a/packages/core/src/__tests__/release.test.ts
+++ b/packages/core/src/__tests__/release.test.ts
@@ -24,7 +24,7 @@ const constructor = jest.fn();
 const getGitLog = jest.fn();
 const graphql = jest.fn();
 const getUserByEmail = jest.fn();
-const getPr = jest.fn().mockReturnValue(Promise.resolve());
+const getPr = jest.fn();
 const getPullRequest = jest.fn();
 const getLatestRelease = jest.fn();
 const getSha = jest.fn();
@@ -492,7 +492,7 @@ describe('Release', () => {
 
       getGitLog.mockReturnValueOnce(commits);
       getCommitsForPR.mockReturnValueOnce(Promise.resolve(undefined));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
       getCommitsForPR.mockReturnValueOnce(Promise.resolve([{ sha: '3' }]));
       graphql.mockReturnValueOnce({
         hash_1: { edges: [] }
@@ -516,11 +516,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(
-        Promise.resolve({
-          data: { labels: [], user: { login: 'adierkens' } }
-        })
-      );
+      getPr.mockReturnValueOnce({
+        data: { labels: [], user: { login: 'adierkens' } }
+      });
       getUserByUsername.mockReturnValueOnce({
         login: 'adierkens',
         name: 'Adam Dierkens'
@@ -540,12 +538,10 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['major'])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['documentation', 'internal']))
-      );
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['patch'])));
+      getPr.mockReturnValueOnce(mockLabels(['major']));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
+      getPr.mockReturnValueOnce(mockLabels(['documentation', 'internal']));
+      getPr.mockReturnValueOnce(mockLabels(['patch']));
 
       expect(await gh.generateReleaseNotes('1234', '123')).toMatchSnapshot();
     });
@@ -561,7 +557,7 @@ describe('Release', () => {
       getCommitsForPR.mockReturnValueOnce(Promise.resolve([{ sha: '1a1a' }]));
 
       searchRepo.mockReturnValueOnce({ items: [{ number: 123 }] });
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
       getPullRequest.mockReturnValueOnce({
         data: {
           number: 123,
@@ -599,7 +595,7 @@ describe('Release', () => {
       getCommitsForPR.mockReturnValueOnce(Promise.resolve([{ sha: '1a1a' }]));
 
       searchRepo.mockReturnValueOnce({ items: [{ number: 123 }] });
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
       getPullRequest.mockReturnValueOnce({
         data: {
           number: 123,
@@ -816,7 +812,7 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe(SEMVER.minor);
     });
@@ -830,15 +826,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['skip-release', 'patch']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['skip-release', 'patch']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['skip-release', 'minor']))
-      );
+      getPr.mockReturnValueOnce(mockLabels(['skip-release', 'patch']));
+      getPr.mockReturnValueOnce(mockLabels(['skip-release', 'patch']));
+      getPr.mockReturnValueOnce(mockLabels(['skip-release', 'minor']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe('');
     });
@@ -852,13 +842,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['patch'])));
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['skip-release', 'patch']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['skip-release', 'minor']))
-      );
+      getPr.mockReturnValueOnce(mockLabels(['patch']));
+      getPr.mockReturnValueOnce(mockLabels(['skip-release', 'patch']));
+      getPr.mockReturnValueOnce(mockLabels(['skip-release', 'minor']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe(SEMVER.minor);
     });
@@ -872,9 +858,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['skip-release'])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels([])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels([])));
+      getPr.mockReturnValueOnce(mockLabels(['skip-release']));
+      getPr.mockReturnValueOnce(mockLabels([]));
+      getPr.mockReturnValueOnce(mockLabels([]));
 
       expect(await gh.getSemverBump('1234', '123')).toBe('');
     });
@@ -893,9 +879,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['patch'])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['major'])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['patch'])));
+      getPr.mockReturnValueOnce(mockLabels(['patch']));
+      getPr.mockReturnValueOnce(mockLabels(['major']));
+      getPr.mockReturnValueOnce(mockLabels(['patch']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe('');
     });
@@ -914,11 +900,9 @@ describe('Release', () => {
       ];
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['release', 'patch']))
-      );
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['patch'])));
-      getPr.mockReturnValueOnce(Promise.resolve(mockLabels(['minor'])));
+      getPr.mockReturnValueOnce(mockLabels(['release', 'patch']));
+      getPr.mockReturnValueOnce(mockLabels(['patch']));
+      getPr.mockReturnValueOnce(mockLabels(['minor']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe(SEMVER.minor);
     });
@@ -946,28 +930,16 @@ describe('Release', () => {
 
       // Test default labels do nothing
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Major']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Patch']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Minor', 'release']))
-      );
+      getPr.mockReturnValueOnce(mockLabels(['Version: Major']));
+      getPr.mockReturnValueOnce(mockLabels(['Version: Patch']));
+      getPr.mockReturnValueOnce(mockLabels(['Version: Minor', 'release']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe('');
 
       getGitLog.mockReturnValueOnce(commits);
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Minor', 'Deploy']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Major']))
-      );
-      getPr.mockReturnValueOnce(
-        Promise.resolve(mockLabels(['Version: Patch']))
-      );
+      getPr.mockReturnValueOnce(mockLabels(['Version: Minor', 'Deploy']));
+      getPr.mockReturnValueOnce(mockLabels(['Version: Major']));
+      getPr.mockReturnValueOnce(mockLabels(['Version: Patch']));
 
       expect(await gh.getSemverBump('1234', '123')).toBe(SEMVER.major);
     });
diff --git a/plugins/all-contributors/__tests__/all-contributors.test.ts b/plugins/all-contributors/__tests__/all-contributors.test.ts
index d8b0e1b9..2e14d0db 100644
--- a/plugins/all-contributors/__tests__/all-contributors.test.ts
+++ b/plugins/all-contributors/__tests__/all-contributors.test.ts
@@ -74,7 +74,9 @@ describe('All Contributors Plugin', () => {
       ]
     });
 
-    expect(exec.mock.calls[0][0]).toBe('npx all-contributors add Jeff code');
+    expect(exec.mock.calls[0][0]).toBe(
+      'npx all-contributors-cli add Jeff code'
+    );
   });
 
   test('should find contributions from merge commit', async () => {
@@ -101,7 +103,9 @@ describe('All Contributors Plugin', () => {
       ]
     });
 
-    expect(exec.mock.calls[0][0]).toBe('npx all-contributors add Jeff code');
+    expect(exec.mock.calls[0][0]).toBe(
+      'npx all-contributors-cli add Jeff code'
+    );
   });
 
   test('should find a multiple contributions', async () => {
@@ -136,7 +140,7 @@ describe('All Contributors Plugin', () => {
     });
 
     expect(exec.mock.calls[0][0]).toBe(
-      'npx all-contributors add Jeff code,test'
+      'npx all-contributors-cli add Jeff code,test'
     );
   });
 
@@ -166,7 +170,7 @@ describe('All Contributors Plugin', () => {
     });
 
     expect(exec.mock.calls[0][0]).toBe(
-      'npx all-contributors add Jeff infra,code'
+      'npx all-contributors-cli add Jeff infra,code'
     );
   });