-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix(createGHA): git remote connection errors #705
Conversation
describe blocks weren't being distinguished properly so this fixes that
{ cmd: 'openapi:validate', CmdClass: OpenAPIValidateCommand, opts: { spec: 'petstore.json' } }, | ||
{ cmd: 'openapi', CmdClass: OpenAPICommand, opts: { key, spec: 'petstore.json', id: 'spec_id' } }, | ||
{ cmd: 'docs', CmdClass: DocsCommand, opts: { key, folder: './docs', version: '1.0.0' } }, | ||
{ cmd: 'docs', CmdClass: DocsCommand, opts: { key, filePath: './docs/rdme.md', version: '1.0.0' } }, | ||
{ cmd: 'changelogs', CmdClass: ChangelogsCommand, opts: { key, filePath: './changelogs' } }, | ||
{ cmd: 'changelogs', CmdClass: ChangelogsCommand, opts: { key, filePath: './changelogs/rdme.md' } }, | ||
{ cmd: 'custompages', CmdClass: CustomPagesCommand, opts: { key, filePath: './custompages' } }, | ||
{ cmd: 'openapi:validate', CmdClass: OpenAPIValidateCommand, opts: { spec: 'petstore.json' }, label: '' }, | ||
{ cmd: 'openapi', CmdClass: OpenAPICommand, opts: { key, spec: 'petstore.json', id: 'spec_id' }, label: '' }, | ||
{ cmd: 'docs', CmdClass: DocsCommand, opts: { key, folder: './docs', version: '1.0.0' }, label: '' }, | ||
{ | ||
cmd: 'docs', | ||
CmdClass: DocsCommand, | ||
label: ' (single)', | ||
opts: { key, filePath: './docs/rdme.md', version: '1.0.0' }, | ||
}, | ||
{ cmd: 'changelogs', CmdClass: ChangelogsCommand, opts: { key, filePath: './changelogs' }, label: '' }, | ||
{ | ||
cmd: 'changelogs', | ||
CmdClass: ChangelogsCommand, | ||
label: ' (single)', | ||
opts: { key, filePath: './changelogs/rdme.md' }, | ||
}, | ||
{ cmd: 'custompages', CmdClass: CustomPagesCommand, opts: { key, filePath: './custompages' }, label: '' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stuff just splits up the describe
blocks, which were getting unwieldy since we consolidated the docs
and docs:single
commands.
@@ -1,6 +1,6 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
|
|||
exports[`#createGHA command inputs changelogs should run GHA creation workflow and generate valid workflow file 1`] = ` | |||
exports[`#createGHA command inputs changelogs (single) should run GHA creation workflow and generate valid workflow file 1`] = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just the resulting snapshot changes from splitting up the describe blocks above. No actual content changes here.
@@ -191,7 +210,7 @@ describe('#createGHA', () => { | |||
delete process.env.TEST_RDME_NPM_SCRIPT; | |||
}); | |||
|
|||
it('should not run if repo only contains non-GitHub remotes', () => { | |||
it('should not run if repo solely contains non-GitHub remotes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed this so I don't have to see it when grepping the testbed for .only
lol
src/lib/createGHA/index.ts
Outdated
@@ -186,7 +191,7 @@ export default async function createGHA( | |||
if (msg) info(msg, false); | |||
|
|||
if (opts.github) { | |||
info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n", false)); | |||
info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n"), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth changing the signature on info
to have that includeEmojiPrefix
option be supplied as an object instead to prevent this from happening again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done: 8be0062
src/lib/createGHA/index.ts
Outdated
@@ -186,7 +191,7 @@ export default async function createGHA( | |||
if (msg) info(msg, false); | |||
|
|||
if (opts.github) { | |||
info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n", false)); | |||
info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n"), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth changing the signature on info
to have that includeEmojiPrefix
option be supplied as an object instead to prevent this from happening again
🧰 Changes
Turns out we were missing some error handling in our git logic, which was leading to the errors like we're seeing in #704 (and maybe even #664):
This is because the command
git remote show <remote>
1 errors out if unable to connect to the remote URL. Thankfully, the fix was a single.catch
statement 😮💨When in these files, I made a couple of other tiny touch-ups:
__tests__/lib/createGHA.test.ts
, which weren't properly being separated due to certain describe block titles being the same when they shouldn't be.debug
statement somewhere where it'd be helpfulfalse
in the wrong place, leading to an ugly stdout statement here:when it should actually be this:
🧬 QA & Testing
You can reproduce this issue pretty easily by doing the following on the
main
branch:If you run through steps 1-5 in this branch, you should see the following output in step 4 instead:
If you see the same results and the tests + code look good, we should be good to go!
Footnotes
this is almost always
git remote show origin
↩