composer-install icon indicating copy to clipboard operation
composer-install copied to clipboard

Composer config for http-basic

Open rreynier opened this issue 3 years ago • 3 comments

I am trying to install Laravel Nova in my CI workflow. Nova requires authentication. The easiest way which I did in the past when I manually installed Composer (without this action) was to simply run:

composer config http-basic.nova.laravel.com ${NOVA_USERNAME} ${NOVA_PASSWORD}

Can this be done with this action? Looks like maybe not at least out of the box.

rreynier avatar Sep 22 '21 17:09 rreynier

I'm not sure this should be a concern of this action.

Try out something like this, and let me know if it works for you:

- name: "Configure Composer"
  run: |
    composer config http-basic.nova.laravel.com ${NOVA_USERNAME} ${NOVA_PASSWORD}
- uses: "ramsey/composer-install@v2"

ramsey avatar Dec 24 '21 00:12 ramsey

If I may, I had today with same kind of problem. I wanted to access one of my fork from another project on GitHub.

After reading :

  • https://getcomposer.org/doc/articles/authentication-for-private-packages.md#authentication-using-the-composer-auth-environment-variable
  • https://www.previousnext.com.au/blog/managing-composer-github-access-personal-access-tokens

I suggest to use the COMPOSER_AUTH env var strategy

In my case, I've added in my GitHub workflow :

        env:
            COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.CI_TOKEN }}"}}'

Using https://getcomposer.org/doc/articles/authentication-for-private-packages.md#http-basic is quite the same (just adjust the json syntax and secrets used

llaville avatar Feb 14 '22 15:02 llaville

@ramsey Perharps a NOTE (section about authentication) in the README page will be welcome !

llaville avatar Feb 14 '22 15:02 llaville