From 079e9a96fdfc3e34a537b2bccb07f996fdd92ec2 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Fri, 20 Nov 2026 14:05:26 +0100 Subject: [PATCH] feat: check that Drupal config is up to date in site.yaml --- CHANGELOG.md | 4 ++++ docs/github-actions-templates.md | 8 +++++++- github/workflows/drupal/site.yaml | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fde84719..2e9b17ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Changelog", this file is a reverse-chronological list of merged pull requests. ## Open PR's +- [PR-165](https://github.com/itk-dev/devops_itkdev-docker/pull/165) - 2026-11-20 - + Drupal `site.yaml` workflow: check that the config in `config/sync` is up to + date. The `install-site` job exports the config and fails if the export + changes, adds or deletes a file - [PR-162](https://github.com/itk-dev/devops_itkdev-docker/pull/162) - 2026-11-02 - Switched the Drupal, Symfony and Drupal module templates to PHP 8.5. The `drupal-10` template stays on PHP 8.4, as Drupal 10 does not support 8.5 diff --git a/docs/github-actions-templates.md b/docs/github-actions-templates.md index c462c63a..aadd53b1 100644 --- a/docs/github-actions-templates.md +++ b/docs/github-actions-templates.md @@ -1,6 +1,6 @@ @@ -173,6 +173,11 @@ in `composer.json`: Checks that site can be installed and can be updated (from base branch on pull request). +Also checks that the config in `config/sync` is up to date: the job exports +the config of the installed site, and fails if the export changes any file +in `config/sync`. To fix it, install the site from config, run `drush +config:export` and commit the changes. + #### Assumptions 1. A docker compose service named `phpfpm` can be run and `composer` can be @@ -181,6 +186,7 @@ pull request). services and the default settings match connection credentials for these services. 3. The Drupal site can be installed from existing config. +4. The config sync directory is `config/sync`. --- diff --git a/github/workflows/drupal/site.yaml b/github/workflows/drupal/site.yaml index c9447fc4..57c125a1 100644 --- a/github/workflows/drupal/site.yaml +++ b/github/workflows/drupal/site.yaml @@ -7,6 +7,11 @@ ### Checks that site can be installed and can be updated (from base branch on ### pull request). ### +### Also checks that the config in `config/sync` is up to date: the job exports +### the config of the installed site, and fails if the export changes any file +### in `config/sync`. To fix it, install the site from config, run `drush +### config:export` and commit the changes. +### ### #### Assumptions ### ### 1. A docker compose service named `phpfpm` can be run and `composer` can be @@ -15,6 +20,7 @@ ### services and the default settings match connection credentials for these ### services. ### 3. The Drupal site can be installed from existing config. +### 4. The config sync directory is `config/sync`. name: Drupal @@ -59,6 +65,14 @@ jobs: # Install the site from config docker compose exec phpfpm vendor/bin/drush site:install --existing-config --yes + - name: Check that config is up to date + run: | + # Export the config of the installed site. "git add" also includes new + # and deleted files in the diff. + docker compose exec phpfpm vendor/bin/drush config:export --yes + git add --all config/sync + git diff --cached --exit-code config/sync + - name: Show site URL run: | echo $(docker compose exec phpfpm vendor/bin/drush --uri=http://$(docker compose port nginx 8080) user:login)