Reputation: 571
I am using GitHub Actions to run PHP CS Fixer and PHPUnit for each pull request created. I implemented this GitHub Action for PHPUnit and my YML file is as follows.
name: PHPUnit Tests
on: [push]
jobs:
build-test:
name: PHPUnit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: php-actions/composer@v5
with:
php_extensions: mailparse pdo_mysql
dev: no
args: --profile --ignore-platform-reqs
- name: PHPUnit Tests
uses: php-actions/phpunit@v3
with:
php_version: 8.1
I am having below error from PHPUnit Action.
994393dc58e7: Layer already exists
1e74372f6dff: Pushed
php-latest-mailparse-pdo_mysql-build2: digest: sha256:17078db8c8e36a72ce937d8b5f98eb0c0b814b91a2c20e14788039763b722300 size: 2831
Docker tag: docker.pkg.github.com/synega/connect/php-actions_composer_connect:php-latest-mailparse-pdo_mysql-build2
No private keys supplied
Command: composer install --no-dev --no-progress --no-interaction --profile --ignore-platform-reqs
Error: Process completed with exit code 1.
How/where i can get private keys for mailparse
? Any help will be much appreciated.
Upvotes: 3
Views: 1063
Reputation: 3299
It isn't mailparse
specifically that needs the private key, it's the project as a whole - private repositories need to use SSH authentication - see the composer-php-actions manual:
To install from a private repository, SSH authentication must be used. Generate an SSH key pair for this purpose and add it to your private repository's configuration, preferable with only read-only privileges. On Github for instance, this can be done by using deploy keys.
Add the key pair to your project using Github Secrets, and pass them into the php-actions/composer action by using the ssh_key and ssh_key_pub inputs. If your private repository is stored on another server than github.com, you also need to pass the domain via ssh_domain.
Example yaml, showing how to pass secrets:
jobs: build: ... - name: Install dependencies uses: php-actions/composer@v6 with: ssh_key: ${{ secrets.ssh_key }} ssh_key_pub: ${{ secrets.ssh_key_pub }}
There is an example repository available for reference at https://github.com/php-actions/example-composer that uses a private dependency. Check it out for a live working project.
The documentation on Github Secrets walks through how to create them for Github.
Upvotes: 2