diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 01ec3260..3d692c03 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,14 +9,15 @@ This project adheres to [Semantic Versioning](http://semver.org/). The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com). ## [Unreleased] - ### Changed - Updated all uses of `actions/checkout` from `v3` (using node 16) to `v4` (using node 20), because [actions using node 16 are deprecated](https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/) and will stop working in the future. -* ACTION SUGGESTED: In order to avoid the node 16 deprecation warnings, update your workflows to use `actions/checkout@v4`. +- ACTION SUGGESTED: In order to avoid the node 16 deprecation warnings, update your workflows to use `actions/checkout@v4`. ### Deprecated - The `phpcpd` command (that uses the [PHP Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd), now abandoned) has been deprecated in this `moodle-plugin-ci` release (4.4.0) and will be removed in 5.0.0. No replacement is planned. - ACTION SUGGESTED: In order to avoid deprecation warnings or annotations, proceed to remove this command from your workflows. Note that any use will throw an error in the next major release (5.0.0). +- The `master` branch of Moodle upstream repositories has been moved to `main` and will stop working soon (see [MDLSITE-7418](https://tracker.moodle.org/browse/MDLSITE-7418) for details). GitHub workflows will start emitting warnings/annotations when uses of the `master` branch are detected. +- ACTION SUGGESTED: In order to avoid deprecation warnings or annotations, proceed to replace `master` by `main` in your workflows. Note that any use of the former (to be removed) will throw an error in the future. ## [4.3.2] - 2024-01-26 ### Changed diff --git a/src/Command/CopyPasteDetectorCommand.php b/src/Command/CopyPasteDetectorCommand.php index 634d08fb..3c0efcb9 100644 --- a/src/Command/CopyPasteDetectorCommand.php +++ b/src/Command/CopyPasteDetectorCommand.php @@ -38,6 +38,7 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { + // @codeCoverageIgnoreStart if (!defined('PHPUNIT_TEST')) { // Only show deprecation warnings in non-test environments. trigger_deprecation( 'moodle-plugin-ci', @@ -51,6 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'is deprecated and will be removed in 5.0.0. No replacement is planned.' . PHP_EOL; } } + // @codeCoverageIgnoreEnd $timer = new Timer(); $timer->start(); diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php index d086e16e..69c40de2 100644 --- a/src/Command/InstallCommand.php +++ b/src/Command/InstallCommand.php @@ -62,6 +62,17 @@ protected function configure(): void $extra = getenv('EXTRA_PLUGINS_DIR') !== false ? getenv('EXTRA_PLUGINS_DIR') : null; $node = getenv('NODE_VERSION') !== false ? getenv('NODE_VERSION') : null; + // Emit a warning/annotation under GHA if the branch is master (recommending to move to main). + // @codeCoverageIgnoreStart + if (getenv('GITHUB_ACTIONS')) { // Only show annotations in GitHub Actions. + if ($branch === 'master') { // And only if the branch being used is master. + echo '::warning title=`master` branch use detected::The `master` branch of Moodle has been ' . + 'moved to `main` and will stop working soon. Please consider moving to `main` in your ' . + 'workflows. Ref.: MDLSITE-7418' . PHP_EOL; + } + } + // @codeCoverageIgnoreEnd + // As there is not only Travis CI, it can also be passed a generic environment variable. if (null === $plugin) { $plugin = getenv('CI_BUILD_DIR') !== false ? getenv('CI_BUILD_DIR') : null;