Skip to content

Commit

Permalink
Merge pull request #2171 from intuit/update-octokit
Browse files Browse the repository at this point in the history
Update octokit
  • Loading branch information
hipstersmoothie committed Mar 20, 2022
2 parents a021356 + b7972cb commit d2c8dd1
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 91 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"change-case": "^4.0.0",
"command-line-docs": "^0.0.6",
"copy-template-dir": "^1.4.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^8.0.0",
"eslint-config-xo": "^0.33.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"await-to-js": "^3.0.0",
"chalk": "^4.0.0",
"command-line-application": "^0.10.1",
"endent": "^2.0.1",
"endent": "^2.1.0",
"module-alias": "^2.2.2",
"signale": "^1.4.0",
"terminal-link": "^2.1.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"@auto-it/bot-list": "link:../../packages/bot-list",
"@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2",
"@octokit/plugin-enterprise-compatibility": "1.3.0",
"@octokit/plugin-retry": "^3.0.1",
"@octokit/plugin-throttling": "^3.2.0",
"@octokit/rest": "^18.0.0",
"@octokit/plugin-retry": "^3.0.9",
"@octokit/plugin-throttling": "^3.6.2",
"@octokit/rest": "^18.12.0",
"await-to-js": "^3.0.0",
"chalk": "^4.0.0",
"cosmiconfig": "7.0.0",
"deepmerge": "^4.0.0",
"dotenv": "^8.0.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"enquirer": "^2.3.4",
"env-ci": "^5.0.1",
"fast-glob": "^3.1.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/__tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ describe("github", () => {

getByUsername.mockReturnValueOnce({
data: { name: "Andrew Lisowski" },
status: 200,
});

expect(await gh.getUserByUsername("andrew")).toStrictEqual({
Expand Down Expand Up @@ -792,8 +793,8 @@ describe("github", () => {
message: "The request has failed",
status: 404,
response: {
headers
}
headers,
},
});

// eslint-disable-next-line no-new
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ export default class Git {
this.github.hook.error("request", (error) => {
if (error) {
// narrow down the type
if ("headers" in error && error.headers.authorization) {
if ("headers" in error && error.request.headers.authorization) {
delete error.request.headers.authorization;
delete error.headers.authorization;
}
}
Expand Down Expand Up @@ -480,6 +481,10 @@ export default class Git {
username,
});

if (user.status !== 200) {
return;
}

return user.data;
} catch (error) {
this.logger.verbose.warn(`Could not find user by username: ${username}`);
Expand Down Expand Up @@ -851,7 +856,7 @@ export default class Git {
releaseNotes: string,
tag: string,
prerelease = false,
fallbackCommit?: string,
fallbackCommit?: string
) {
this.logger.verbose.info("Creating release on GitHub for tag:", tag);

Expand Down
4 changes: 2 additions & 2 deletions plugins/all-contributors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"dependencies": {
"@auto-it/bot-list": "link:../../packages/bot-list",
"@auto-it/core": "link:../../packages/core",
"@octokit/rest": "^18.0.0",
"@octokit/rest": "^18.12.0",
"all-contributors-cli": "6.19.0",
"anymatch": "^3.1.1",
"await-to-js": "^3.0.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"env-ci": "^5.0.1",
"fp-ts": "^2.5.3",
"fromentries": "^1.2.0",
Expand Down
8 changes: 1 addition & 7 deletions plugins/all-contributors/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
inFolder,
validatePluginConfiguration,
} from "@auto-it/core";
import { RestEndpointMethodTypes } from "@octokit/rest";
import envCi from "env-ci";
import endent from "endent";
import botList from "@auto-it/bot-list";
Expand Down Expand Up @@ -381,12 +380,7 @@ export default class AllContributorsPlugin implements IPlugin {
auto.git?.getUserByUsername(contributor)
)
)
).filter(
(
c
): c is RestEndpointMethodTypes["users"]["getByUsername"]["response"]["data"] =>
Boolean(c)
);
).filter((c): c is NonNullable<typeof c> => Boolean(c));

return {
...commit,
Expand Down
12 changes: 7 additions & 5 deletions plugins/cocoapods/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ export default class CocoapodsPlugin implements IPlugin {
}

const remoteRepo = pr
? await (await auto.git.getPullRequest(pr)).data.head.repo.clone_url
? (await auto.git.getPullRequest(pr)).data.head.repo?.clone_url ||
auto.remote
: auto.remote;

const lastRelease = await auto.git.getLatestRelease();
Expand Down Expand Up @@ -295,11 +296,12 @@ export default class CocoapodsPlugin implements IPlugin {

// Reset changes to podspec file since it doesn't need to be committed
await this.paths.reduce(
(promise, path) => promise.then(async () => {
await execPromise("git", ["checkout", path])
}),
(promise, path) =>
promise.then(async () => {
await execPromise("git", ["checkout", path]);
}),
Promise.resolve()
)
);

return canaryVersion;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/conventional-commits/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"conventional-changelog-core": "^4.2.0",
"conventional-changelog-preset-loader": "^2.3.4",
"conventional-commits-parser": "^3.1.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"fp-ts": "^2.5.3",
"io-ts": "^2.1.2",
"tslib": "2.1.0"
Expand Down
2 changes: 1 addition & 1 deletion plugins/exec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@auto-it/core": "link:../../packages/core",
"endent": "^2.0.1",
"endent": "^2.1.0",
"fp-ts": "^2.5.3",
"fromentries": "^1.2.0",
"io-ts": "^2.1.2",
Expand Down
4 changes: 2 additions & 2 deletions plugins/first-time-contributor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"@auto-it/bot-list": "link:../../packages/bot-list",
"@auto-it/core": "link:../../packages/core",
"array.prototype.flatmap": "^1.2.2",
"endent": "^2.0.1",
"endent": "^2.1.0",
"tslib": "2.1.0",
"url-join": "^4.0.0"
},
"devDependencies": {
"@octokit/rest": "^18.0.0",
"@octokit/rest": "^18.12.0",
"@types/array.prototype.flatmap": "^1.2.0"
}
}
2 changes: 1 addition & 1 deletion plugins/gem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@auto-it/core": "link:../../packages/core",
"endent": "^2.0.1",
"endent": "^2.1.0",
"env-ci": "^5.0.1",
"fast-glob": "^3.1.1",
"fp-ts": "^2.5.3",
Expand Down
2 changes: 1 addition & 1 deletion plugins/gh-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@auto-it/core": "link:../../packages/core",
"endent": "^2.0.1",
"endent": "^2.1.0",
"fp-ts": "^2.5.3",
"io-ts": "^2.1.2",
"push-dir": "^0.4.1",
Expand Down
4 changes: 2 additions & 2 deletions plugins/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@auto-it/core": "link:../../packages/core",
"@auto-it/package-json-utils": "link:../../packages/package-json-utils",
"await-to-js": "^3.0.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"env-ci": "^5.0.1",
"fp-ts": "^2.5.3",
"get-monorepo-packages": "^1.1.0",
Expand All @@ -54,7 +54,7 @@
"user-home": "^2.0.0"
},
"devDependencies": {
"@octokit/rest": "^18.0.0",
"@octokit/rest": "^18.12.0",
"@types/env-ci": "^3.1.0",
"@types/semver": "^7.1.0",
"@types/url-join": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/released/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"tslib": "2.1.0"
},
"devDependencies": {
"@octokit/rest": "^18.0.0"
"@octokit/rest": "^18.12.0"
}
}
2 changes: 1 addition & 1 deletion plugins/slack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@atomist/slack-messages": "^1.2.2",
"@auto-it/core": "link:../../packages/core",
"@octokit/rest": "^18.0.0",
"@octokit/rest": "^18.12.0",
"fp-ts": "^2.5.3",
"https-proxy-agent": "^5.0.0",
"io-ts": "^2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion plugins/twitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@auto-it/core": "link:../../packages/core",
"@types/twitter-text": "^3.1.0",
"endent": "^2.0.1",
"endent": "^2.1.0",
"fp-ts": "^2.5.3",
"io-ts": "^2.1.2",
"semver": "^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions plugins/upload-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@auto-it/core": "link:../../packages/core",
"endent": "^2.0.1",
"endent": "^2.1.0",
"fast-glob": "^3.1.1",
"file-type": "^16.0.0",
"fp-ts": "^2.5.3",
Expand All @@ -48,6 +48,6 @@
"tslib": "2.1.0"
},
"devDependencies": {
"@octokit/rest": "^18.0.0"
"@octokit/rest": "^18.12.0"
}
}
Loading

0 comments on commit d2c8dd1

Please sign in to comment.