Skip to content
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

Improve setup-ci command with helper links and allow override #3438

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

TomasVotruba
Copy link
Member

No description provided.

@TomasVotruba TomasVotruba changed the title CI github Improve setup-ci command with helper links and allow override Mar 2, 2023
@TomasVotruba TomasVotruba enabled auto-merge (squash) March 2, 2023 15:16
@TomasVotruba TomasVotruba merged commit efc969e into main Mar 2, 2023
@TomasVotruba TomasVotruba deleted the tv-suggest-ci branch March 2, 2023 15:22
Copy link

@gplanchat gplanchat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 praise: It's a great addition‏


$workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml');
$workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 suggestion: I usually prefer this notation for readability

Suggested change
$workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml');
$workflowTemplate = FileSystem::read(dirname(__DIR__, 3) . '/templates/rector-github-action-check.yaml');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually shuts the PHPStan check for missing file.
Also is dynamic over static value.

Comment on lines +86 to +90
$this->symfonyStyle->writeln(
'1) Generate new Github Token here:' .
PHP_EOL .
'https://github.com/settings/tokens/new'
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 suggestion: I would add a clickable link, in order to simplify usage

Suggested change
$this->symfonyStyle->writeln(
'1) Generate new Github Token here:' .
PHP_EOL .
'https://github.com/settings/tokens/new'
);
$this->symfonyStyle->writeln(
'1) Generate new Github Token here:' .
PHP_EOL .
'<href=https://github.com/settings/tokens/new>https://github.com/settings/tokens/new</>'
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3457 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3457 :)

Comment on lines +94 to +98
$this->symfonyStyle->writeln(
'2) Add it to your repository secrets under "GITHUB_TOKE" name:'
. PHP_EOL .
sprintf('https://github.com/%s/settings/secrets/actions/new', $currentRepository)
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 suggestion: Here too, I would add a clickable link, in order to simplify usage

Suggested change
$this->symfonyStyle->writeln(
'2) Add it to your repository secrets under "GITHUB_TOKE" name:'
. PHP_EOL .
sprintf('https://github.com/%s/settings/secrets/actions/new', $currentRepository)
);
$this->symfonyStyle->writeln(
'2) Add it to your repository secrets under "GITHUB_TOKE" name:'
. PHP_EOL .
sprintf('<href=https://github.com/%s/settings/secrets/actions/new>https://github.com/%s/settings/secrets/actions/new</>‏', $currentRepository)
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. How does this look in the Symfony style?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on your shell, usually it prints the link bolder or sharper, and underlined.

See https://symfony.com/blog/new-in-symfony-4-3-console-hyperlinks

sprintf('https://github.com/%s/settings/secrets/actions/new', $currentRepository)
);

$this->symfonyStyle->newLine();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Most people don't read these, so we have limit for 2 links maximum. This command should help people just dump it and use it.

Which 2 links would you go for having typical Rector developer in mind?

Copy link

@gplanchat gplanchat Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best would be an info message at the end, telling "If you want to get deeper and configure actions for a whole organization, please see [...]" with the link to the organization access token configuration.

@TomasVotruba
Copy link
Member Author

@gplanchat Thanks for quick testing and feedback 👍 This will allow people to use Rector in CI on massive level 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants