gpt4 book ai didi

php - PHPUnit 的 GitHub 操作失败

转载 作者:行者123 更新时间:2023-12-05 04:21:19 37 4
gpt4 key购买 nike

我正在使用 GitHub Actions 为创建的每个拉取请求运行 PHP CS Fixer 和 PHPUnit。我为 PHPUnit 实现了这个 GitHub Action,我的 YML 文件如下。

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

我在 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.

我如何/在哪里可以获得 mailparse 的私钥?任何帮助将不胜感激。

最佳答案

不是 mailparse 需要私钥,而是整个项目 - 私有(private)存储库需要使用 SSH 身份验证 - 请参阅 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.

关于 Github Secrets 的文档介绍了如何为 Github 创建它们。

关于php - PHPUnit 的 GitHub 操作失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74254311/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com