diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0cb35b47b..dda9faa89 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -80,3 +80,26 @@ jobs:
- name: Run a single unit test to verify the testing setup
run: ./vendor/bin/phpunit -c ./web/core $(pwd)/web/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php
+
+ # Using outdated Composer version to test the Composer version constraint.
+ test-composer:
+ runs-on: ubuntu-latest
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 8.2
+ extensions: gd, pdo_sqlite
+ tools: composer:v2.2
+
+ - name: Show Composer version
+ run: composer --version
+
+ - name: Install dependencies
+ # This command should fail because of the Composer version constraint.
+ run: composer --verbose install && exit 1 || exit 0
diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php
index 27efd7c69..088c2b608 100644
--- a/scripts/composer/ScriptHandler.php
+++ b/scripts/composer/ScriptHandler.php
@@ -92,8 +92,8 @@ public static function checkComposerVersion(Event $event) {
if ($version === '@package_version@' || $version === '@package_branch_alias_version@') {
$io->writeError('You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.');
}
- elseif (Comparator::lessThan($version, '1.0.0')) {
- $io->writeError('Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing.');
+ elseif (Comparator::lessThan($version, '2.3.6')) {
+ $io->writeError('Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing.');
exit(1);
}
}