From b920b326d6f1952cc05e4800f3c9210ba7ccced4 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Thu, 13 Oct 2022 17:03:28 -0400 Subject: [PATCH] Update renovate action to update only current app --- .github/workflows/renovate-app-version.sh | 6 ++++-- .github/workflows/renovate-app-version.yml | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/renovate-app-version.sh b/.github/workflows/renovate-app-version.sh index b1c9486c..fa6764f5 100755 --- a/.github/workflows/renovate-app-version.sh +++ b/.github/workflows/renovate-app-version.sh @@ -1,8 +1,10 @@ #!/bin/bash # This script copies the version from docker-compose.yml to config.json. -# find all docker-compose files -docker_compose_files=$(find apps -name docker-compose.yml) +app_name=$1 + +# find all docker-compose files under apps/$app_name (there should be only one) +docker_compose_files=$(find apps/$app_name -name docker-compose.yml) for docker_compose_file in $docker_compose_files do diff --git a/.github/workflows/renovate-app-version.yml b/.github/workflows/renovate-app-version.yml index 06b0bc33..324a5962 100644 --- a/.github/workflows/renovate-app-version.yml +++ b/.github/workflows/renovate-app-version.yml @@ -15,10 +15,23 @@ jobs: run: | git config --local user.email "githubaction@githubaction.com" git config --local user.name "github-action update-app-version" - - - name: Update app version + + - name: Get list of updated files by the last commit seperated by space + id: updated-files run: | - ./.github/workflows/renovate-app-version.sh + echo ${{github.sha}} + echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | tr '\n' ' ')" + + - name: Run renovate-app-version.sh on updated files + run: | + IFS=' ' read -ra files <<< "${{ steps.updated-files.outputs.files }}" + + for file in "${files[@]}"; do + if [[ $file == *"docker-compose.yml"* ]]; then + app_name=$(echo $file | cut -d'/' -f 2) + ./.github/workflows/renovate-app-version.sh $app_name + fi + done - name: Commit & Push Changes run: |