hiqdev/composer-ci-deps-plugin

Composer plugin for installing dependencies from the PRs

dev-master 2025-01-29 08:55 UTC

This package is auto-updated.

Last update: 2025-01-29 08:55:14 UTC


README

Latest Stable Version Total Downloads

This plugin is designed for CI/CD pipelines of a multi-repository project. When a project consists of multiple repositories, it is often necessary to test the changes in the dependencies of the project before merging them. This plugin helps to automate this process.

It allows to automatically patch the dependencies of the project based on the list of pull requests that are currentto be used inly being tested.

Limitations

  1. Currently, the plugin supports pull requests from:
    1. Public GitHub repositories
    2. Private GitLab repositories
  2. Only pull requests against the installed dependency versions are supported. It means that the plugin will not work if the pull request is against the feature branch, and you have the main repo branch installed as a dependency.
  3. If you already use cweagans/composer-patches, in your project, you should install this plugin with caution, as it was not tested in such an environment and may cause conflicts.

Supported environment variables

Installation

composer require --dev hiqdev/composer-ci-deps-plugin

Usage

  1. Create a pull-requests.txt in the root of your project with the list of pull requests, one per line, for example:

    https://gitlab.com/ultimateretro/ultimateretro/-/merge_requests/49
    https://github.com/hiqdev/php-billing/pull/94

    The plugin will automatically detect the type of the pull requests.

  2. Run composer prp – this will download patches from the pull requests and apply them to the dependencies.

Development

The easiest way to test the plugin is to create a new project and require the plugin from the local path:

{
    "repositories": [
        {
            "type": "path",
            "url": "/path/to/composer-ci-deps-plugin"
        }
    ],
    "require-dev": {
        "hiqdev/composer-ci-deps-plugin": "*"
    }
}

Then you can run the plugin with the following command and enjoy the debugging with XDebug:

export XDEBUG_TRIGGER=1
export COMPOSER_ALLOW_XDEBUG=1
export GITLAB_REPO_ACCESS_TOKEN=<your GitLab access token>
composer prp