From d931260235792d0e90f6bb91db700c3595b8e5e5 Mon Sep 17 00:00:00 2001 From: Julian Psotta Date: Tue, 30 Jan 2024 11:30:27 +0100 Subject: [PATCH] feat(config): Add workflow for the automatic config conversion The workflow is triggered on PRs for main and releases/** branches if the PR is set for review or synchronized. --- ...config_rewrite.sh => config_conversion.sh} | 0 .../config-conversion-automation.yml | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+) rename .github/utils/{config_rewrite.sh => config_conversion.sh} (100%) create mode 100644 .github/workflows/config-conversion-automation.yml diff --git a/.github/utils/config_rewrite.sh b/.github/utils/config_conversion.sh similarity index 100% rename from .github/utils/config_rewrite.sh rename to .github/utils/config_conversion.sh diff --git a/.github/workflows/config-conversion-automation.yml b/.github/workflows/config-conversion-automation.yml new file mode 100644 index 0000000000..e714a72fd4 --- /dev/null +++ b/.github/workflows/config-conversion-automation.yml @@ -0,0 +1,37 @@ +name: Automatic conversion of application.yml to ors-config.yml +on: + pull_request: + branches: + - main + - releases/** + - feat/config-cleanup-finalize # for testing + types: [ ready_for_review, synchronize ] + workflow_dispatch: + + +jobs: + detect_config_change: + name: Detect and commit config changes + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Convert application.yml to ors-config.yml + run: | + .github/utils/config_conversion.sh ors-api/src/main/resources/application.yml ors-api/ors-config.yml + - name: Check with git if ors-api/ors-config.yml has changed + id: git-check + run: | + # Don't fail on exit code 1 (diff found) + set +e + git diff --exit-code --name-only ors-api/ors-config.yml + # Write out the exit code using environment file + echo "config_has_changed=$(test $return_value -eq 1)" >> $GITHUB_ENV + - uses: MichaelsJP/git-auto-commit-action@v5 + if: env.config_has_changed == 'true' + with: + commit_message: 'chore(config): automatic conversion of application.yml to ors-config.yml' \ No newline at end of file