PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
542 stars 36 forks source link

Add COMPOSER_AUTH env variable to workflows #200

Open Potherca opened 1 year ago

Potherca commented 1 year ago

Proposed Changes

Because of the amount of GitHub API calls composer does, the CI runs into a rate limit. This causes jobs to fail or be aborted. Adding the GITHUB_TOKEN as auth method should avoid these rate limits.

Related Issues

Potherca commented 1 year ago

Accidentaly pressed the "Request Review" button again. Sorry!

Potherca commented 1 year ago

From what I could see, the error in the powershell were triggered by composer, caused by the rate limit:

Run shivammathur/setup-php@v2 "C:\Program Files\PowerShell\7\pwsh.exe" D:\a_actions\shivammathur\setup-php\v2\src\scripts\run.ps1

... ==> Setup Tools ✗ composer 403: rate limit exceeded Error: The process 'C:\Program Files\PowerShell\7\pwsh.exe' failed with exit code 1

https://github.com/PHPCSStandards/composer-installer/actions/runs/3845986458/jobs/6550770322#step:3:27

The fix was proposed in https://github.com/ramsey/composer-install/issues/182#issuecomment-1039252140 but sadly this change does not seem to fix the rate limit issue so another approach seems needed. I'll take a look at the setup-php docs.

I just added it to all workflows that do a composer install/update just to be safe (as I have no idea how the rate limit between GitHub / Composer / GHA.

Leaving this for now.