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

Specify the version of PHP-CS-Fixer #467

Closed
1 task done
mlocati opened this issue Jun 16, 2021 · 3 comments
Closed
1 task done

Specify the version of PHP-CS-Fixer #467

mlocati opened this issue Jun 16, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@mlocati
Copy link
Contributor

mlocati commented Jun 16, 2021

Describe the feature
It'd be very useful to specify the version of PHP-CS-Fixer to be used.
People may want to specify the major version (tools: php-cs-fixer:v2) or the full version ((tools: php-cs-fixer:v2.2.20).

So, we'd have 3 cases:

  • tools: php-cs-fixer -> setup-php should fetch https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar
  • tools: php-cs-fixer:v2 -> setup-php should fetch https://cs.symfony.com/download/php-cs-fixer-v2.phar
  • tools: php-cs-fixer:v2.3.4 -> setup-php should fetch https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.3.4/php-cs-fixer.phar

Version

  • I have checked releases, and the feature is missing in the latest patch version of v2.

Underlying issue
PHP-CS-Fixer rules and rule sets change across PHP-CS-Fixer versions: we should have a way to be sure about the version we fetch.

Describe alternatives
We now have to fetch the PHAR file of PHP-CS-Fixer with a curl call.

Additional context

Are you willing to submit a PR?
No, sorry 😉

@mlocati mlocati added the enhancement New feature or request label Jun 16, 2021
@shivammathur
Copy link
Owner

shivammathur commented Jun 16, 2021

@mlocati
specifying the exact version is already supported.
https://github.com/shivammathur/test-setup-php/actions/runs/942254049/workflow

I will add support for specifying major version for php-cs-fixer in the next release.

@mlocati
Copy link
Contributor Author

mlocati commented Jun 16, 2021

You are very great, @shivammathur !

@shivammathur shivammathur added the awaiting-release Added/Fixed and tested, awaiting release label Jul 5, 2021
@shivammathur
Copy link
Owner

@mlocati
I added support to specify the major or major.minor version for all tools hosted on GitHub in 2.12.0 release.

While using this you would have to provide a GitHub OAuth token to avoid getting rate limited when setup-php fetches the exact tag release matching the input. You can use the default GITHUB_TOKEN secret for this.

- name: Setup PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '7.4'
    tools: php-cs-fixer:2
  env:
    COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Test workflow: https://github.com/shivammathur/test-setup-php/actions/runs/1029853981/workflow

@shivammathur shivammathur removed the awaiting-release Added/Fixed and tested, awaiting release label Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants