2017 © Pedro Peláez
 

library composer-lock-updater

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

image

danielbachhuber/composer-lock-updater

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  • Wednesday, May 23, 2018
  • by danielbachhuber
  • Repository
  • 3 Watchers
  • 5 Stars
  • 1,030 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 14 Versions
  • 18 % Grown

The README.md

composer-lock-updater

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests., (*1)

Build Status, (*2)

When you run clu, it:, (*3)

  1. Clones a given git repository to a working /tmp/ directory.
  2. Runs composer update within the working directory.
  3. Submits a pull request if changes are detected to a tracked composer.lock file.

Et voila! Now your dependencies are no longer six months out of date., (*4)

composer-lock-updater is different than dependabot in that it bundles all of your updates into one pull request, instead of creating separate pull requests for each dependency., (*5)

Installing | Using | Integrate with Travis CI, (*6)

Installing

composer-lock-updater is a PHP library that can be installed with Composer:, (*7)

composer global require danielbachhuber/composer-lock-updater

composer-lock-updater depends on composer and git being available on the system. For use with GitHub, also install the official hub CLI tool. For use with GitLab, you can use the unofficial lab CLI tool that emulates hub., (*8)

Both hub and lab will need to be authenticated with their respective services in order to create the pull/merge requests., (*9)

Support for other providers

Copy clu-config.dist.json to $COMPOSER_HOME/clu-config.json to add support for your git repository provider, or to make adjustments to the pull request commands. For example, to add support for a Bitbucket-Pantheon project using Terminus Bitbucket Plugin, create the following clu-config.json:, (*10)

{
  "providers": {
    "terminus": {
      "provider": "terminus",
      "exec": ["terminus"],
      "pr_create": "terminus pr-create --title=\"Update Composer dependencies\" --description %s",
      "pr_list": "terminus pr-list",
      "pr_close": "terminus pr-close %d -y",
      "title_pattern": "%(\\d+)\\s+Update Composer dependencies\\s+clu\\-([0-9-]*)%"
    }
  }
}

Using

Run composer-lock-updater within an existing GitHub repository with:, (*11)

clu

composer-lock-updater defaults to using git config --get remote.origin.url. If you'd like to specify a different value, either pass the repository URL as the first positional argument or define a CLU_GIT_URL environment variable., (*12)

To use composer-lock-updater with a GitLab repository, use:, (*13)

clu --provider=gitlab

composer-lock-updater also supports the following environment variables to modify its behavior:, (*14)

  • CLU_COMPOSER_INSTALL_ARGS: Arguments passed to composer install; defaults to --no-dev --no-interaction.
  • CLU_COMPOSER_UPDATE_ARGS: Arguments passed to composer update; defaults to --no-progress --no-dev --no-interaction.
  • CLU_GIT_NAME: Name used for Git commits; defaults to 'composer-lock-update'.
  • CLU_GIT_EMAIL: Email used for Git commits; defaults to 'composer-lock-update@localhost'.

Integrate with Travis CI

This wouldn't be very useful if it didn't run automatically for you., (*15)

To configure composer-lock-updater to run on Travis master branch builds, add the following to your .travis.yml file:, (*16)

    after_script:
      - |
        ###
        # Only run on one job of a master branch build
        ###
        if [ -z "$CLU_RUN" ] || [ "$TRAVIS_BRANCH" != master ] ; then
          echo "composer.lock update disabled for this build"
          return
        fi
        ###
        # Install composer-lock-updater
        ###
        export PATH="$HOME/.composer/vendor/bin:$PATH"
        composer global require danielbachhuber/composer-lock-updater
        ###
        # Install hub for creating GitHub pull requests
        #
        # You could also replace this with lab to create GitLab merge requests.
        ###
        wget -O hub.tgz https://github.com/github/hub/releases/download/v2.2.9/hub-linux-amd64-2.2.9.tgz
        tar -zxvf hub.tgz
        export PATH=$PATH:$PWD/hub-linux-amd64-2.2.9/bin/
        ###
        # Optional: install Sensio Labs security checker to include security advisories in PR comments
        ###
        mkdir -p $HOME/bin
        wget -O $HOME/bin/security-checker.phar http://get.sensiolabs.org/security-checker.phar
        chmod +x $HOME/bin/security-checker.phar 
        ###
        # Run composer-lock-updater
        ###
        clu $CLU_REPO_URL

To grant commit and pull request access to the Travis build, define these private environment variables in the Travis control panel:, (*17)

GITHUB_TOKEN=<personal-oauth-token>
CLU_REPO_URL=https://<personal-oauth-token>:x-oauth-basic@github.com/<org>/<repo>.git

Make sure to replace <personal-oauth-token>, <org> and <repo> with the appropriate values., (*18)

Lastly, because of the CLU_RUN environment variable, composer-lock-updater is disabled by default. Enable it for one job per build by modifying your environment matrix:, (*19)

matrix:
  include:
    - php: 7.1
      env: WP_VERSION=latest PHP_APCU=enabled CLU_RUN=1
    - php: 7.0
      env: WP_VERSION=latest PHP_APCU=enabled
    - php: 5.6
      env: WP_VERSION=latest PHP_APCU=enabled

Because composer-lock-updater is running on the after_script step, make sure to verify it's working correctly, because it won't fail your build if misconfigured., (*20)

The Versions

23/05 2018

dev-master

9999999-dev

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  Sources   Download

MIT

The Development Requires

23/05 2018

v0.3.0

0.3.0.0

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  Sources   Download

MIT

The Development Requires

22/09 2017

v0.2.1

0.2.1.0

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  Sources   Download

MIT

The Development Requires

15/09 2017

v0.2.0

0.2.0.0

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  Sources   Download

MIT

The Development Requires

09/06 2017

v0.1.0

0.1.0.0

Run composer-lock-updater in your CI system for bot-powered composer.lock pull requests.

  Sources   Download

MIT

09/06 2017

v0.0.9

0.0.9.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.8

0.0.8.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.7

0.0.7.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.6

0.0.6.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.5

0.0.5.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.4

0.0.4.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.3

0.0.3.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.2

0.0.2.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT

09/06 2017

v0.0.1

0.0.1.0

Updates composer.lock files for the repositories it monitors.

  Sources   Download

MIT