From ed6232fb474b16c894380bdee6e7a137fbf05ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 25 Mar 2024 08:24:34 +0200 Subject: [PATCH] UHF-9088: Updated install.mk and update-config workflow with the translation workflow update. --- .github/workflows/update-config.yml | 55 ++++++++++++++++++++++++----- tools/make/project/install.mk | 16 +++++---- 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-config.yml b/.github/workflows/update-config.yml index 5f79886fc..7fbcbb7f8 100644 --- a/.github/workflows/update-config.yml +++ b/.github/workflows/update-config.yml @@ -3,6 +3,8 @@ on: repository_dispatch: types: [config_change] name: Update config +env: + GH_TOKEN: ${{ github.token }} jobs: update-config: runs-on: ubuntu-latest @@ -21,9 +23,7 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 + - uses: actions/checkout@v4 - name: Download latest dump env: @@ -37,20 +37,59 @@ jobs: $(drush sql:connect) < latest.sql drush cim -y && drush updb -y && drush cr composer update drupal/helfi_* drupal/hdbt* -W --no-interaction - drush cr && drush updb -y && drush cex -y + drush cr + + # Update translations from localize.drupal.org and helfi-modules + # before running update hooks to reduce clutter in configuration files. + drush locale:check && drush locale:update + drush updb -y + + # Update translations from helfi_platform_config. These translations + # consists of overrides for non customised translations and will + # override current translation with a non customised translation. + drush helfi:locale-import helfi_platform_config + drush cex -y + # Update platform drush helfi:tools:update-platform + - name: Check module versions + id: module-status + run: | + MODE="delete" + drush helfi:tools:check-composer-versions $GITHUB_WORKSPACE/composer.lock --format=markdown_table >> $GITHUB_STEP_SUMMARY && EXIT_CODE=$? || EXIT_CODE=$? + if [ "$EXIT_CODE" -eq 3 ]; then + MODE="upsert" + echo " " >> $GITHUB_STEP_SUMMARY + echo ":warning: Failed to install the latest version of the packages listed above" >> $GITHUB_STEP_SUMMARY + echo " " >> $GITHUB_STEP_SUMMARY + echo "Please run \`composer why-not drupal/package_name package_version\` to see why." >> $GITHUB_STEP_SUMMARY + fi + echo "MODE=$MODE" >> $GITHUB_OUTPUT + cat $GITHUB_STEP_SUMMARY > /tmp/pr-message.txt + - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: - committer: GitHub - author: actions-bot commit-message: Update configuration title: Automatic update labels: auto-update body: | - Updated active configuration. - Updated platform - branch: update-configuration + + - name: Attempt to find PR + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + id: find-pr + run: echo "number=$(gh pr list --base ${BRANCH_NAME} --head update-configuration --json number --jq '.[].number')" >> $GITHUB_OUTPUT + + - name: Comment PR + uses: thollander/actions-comment-pull-request@v2 + if: ${{ steps.find-pr.outputs.number != '' }} + with: + comment_tag: status + mode: ${{ steps.module-status.outputs.MODE }} + filePath: /tmp/pr-message.txt + pr_number: ${{ steps.find-pr.outputs.number }} diff --git a/tools/make/project/install.mk b/tools/make/project/install.mk index 03b477635..889b5c367 100644 --- a/tools/make/project/install.mk +++ b/tools/make/project/install.mk @@ -1,9 +1,9 @@ ifeq ($(DRUPAL_CONF_EXISTS),yes) - DRUPAL_NEW_TARGETS := up build drush-si drush-cr drush-locale-update drush-uli + DRUPAL_NEW_TARGETS := up build drush-si drush-cr drush-locale-update drush-helfi-locale-import drush-uli else - DRUPAL_NEW_TARGETS := up build drush-si helfi-drush-enable-modules drush-locale-update drush-uli + DRUPAL_NEW_TARGETS := up build drush-si drush-helfi-enable-modules drush-locale-update drush-helfi-locale-import drush-uli endif -DRUPAL_POST_INSTALL_TARGETS := drush-deploy drush-locale-update drush-uli +DRUPAL_POST_INSTALL_TARGETS := drush-locale-update drush-deploy drush-helfi-locale-import drush-uli OC_LOGIN_TOKEN ?= $(shell bash -c 'read -s -p "You must obtain an API token by visiting https://oauth-openshift.apps.arodevtest.hel.fi/oauth/token/request (Token):" token; echo $$token') @@ -26,8 +26,8 @@ oc-sync: $(call drush,cim -y) $(call drush,cr) -PHONY += helfi-drush-enable-modules -helfi-drush-enable-modules: ## Enable modules and base configurations. +PHONY += drush-helfi-enable-modules +drush-helfi-enable-modules: ## Enable modules and base configurations. $(call step,Install base configurations...) $(call drush,cr) $(call drush,en -y helfi_platform_config helfi_platform_config_base) @@ -39,5 +39,9 @@ drush-locale-update: ## Update translations. $(call drush,locale:check) $(call drush,locale:update) $(call drush,cr) - $(call step,Import custom translations...) + +PHONY += drush-helfi-locale-import +drush-helfi-locale-import: ## Update translations from helfi platform config. + $(call step,Import helfi platform config translations...) $(call drush,helfi:locale-import helfi_platform_config) + $(call drush,cr)