Skip to content

Commit 42a49a8

Browse files
committed
Composer: prevent a lock file from being created
Composer 1.10.0 introduced a `lock` config option, which, when set to `false` will prevent a `composer.lock` file from being created and will ignore it when one exists. This is a useful option for libraries such as this where the `lock` file has no meaning. It also makes life easier for contributors as they don't have to remember that for this repo they should use `composer update` instead of `composer install`. Both will now work the same. Refs: https://getcomposer.org/doc/06-config.md#lock
1 parent 8db56ec commit 42a49a8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.github/workflows/quicktest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
ini-values: error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On
5252
coverage: none
5353

54+
- name: Enable creation of `composer.lock` file
55+
if: ${{ matrix.dependencies == 'lowest' }}
56+
run: composer config --unset lock
57+
5458
# Install dependencies and handle caching in one go.
5559
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
5660
- name: Install Composer dependencies

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ jobs:
123123
sirbrillig/phpcs-variable-analysis:"2.x"
124124
wp-coding-standards/wpcs:"dev-develop"
125125
126+
- name: Enable creation of `composer.lock` file
127+
if: ${{ matrix.dependencies == 'lowest' }}
128+
run: composer config --unset lock
129+
126130
# Install dependencies and handle caching in one go.
127131
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
128132
- name: Install Composer dependencies

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"config": {
3434
"allow-plugins": {
3535
"dealerdirect/phpcodesniffer-composer-installer": true
36-
}
36+
},
37+
"lock": false
3738
},
3839
"scripts": {
3940
"test-ruleset": "bin/ruleset-tests",

0 commit comments

Comments
 (0)