From 04393de7ac75be072b9079a5779a77f90befe4eb Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 17 Jul 2024 17:43:15 +0200 Subject: [PATCH] Simplify separator handling of changed files array (#40) * try to fix separator * remove local * fix * simplify array * update changelog --- .github/dependabot.yml | 4 ++-- CHANGELOG.md | 8 ++++++-- project/detect-changed-components/action.yml | 18 +++++------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ac19843..4839fa1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,7 @@ updates: - package-ecosystem: "npm" directory: "/" schedule: - interval: monthly + interval: weekly labels: - "dependencies" commit-message: @@ -18,6 +18,6 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: monthly + interval: weekly labels: - "dependencies" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8bea1..74f5a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,13 @@ ## New functionality -`.github/workflows/build.yaml`: Added a callable workflow for building Viash components (PR #38). +* `.github/workflows/build.yaml`: Added a callable workflow for building Viash components (PR #38). -`.github/workflows/test.yaml`: Added a callable workflow for testing Viash components (PR #38). +* `.github/workflows/test.yaml`: Added a callable workflow for testing Viash components (PR #38). + +## Minor changes + +* `project/detect-changed-components`: Simplify separator handling of changed files array (PR #40). ## Bug fixes diff --git a/project/detect-changed-components/action.yml b/project/detect-changed-components/action.yml index 8416122..f6ebd59 100644 --- a/project/detect-changed-components/action.yml +++ b/project/detect-changed-components/action.yml @@ -38,9 +38,9 @@ runs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v42.0.5 + uses: tj-actions/changed-files@v44 with: - separator: ";" + separator: "," diff_relative: true # Note: a component's resources is detected using a jq statement. @@ -90,17 +90,9 @@ runs: # create output array declare -a output_array=() - # The output from changed-files is delimited by \; - # So we use delimiter ';' to read the file and trim the backslash from the end. - declare -a changed_files=() - trim_slash() { - local line=$2 - local trimmed_line=${line/%\\/} - echo "Found changed file: '$trimmed_line'" - changed_files[$1]="${trimmed_line}" - } - # read changed files as array - readarray -d ';' -C trim_slash -c 1 -t <<< "${{ steps.changed-files.outputs.all_changed_files }}" + # The output from changed-files is delimited by , + # also remove newline if any + IFS=$',' read -a changed_files <<< "${{ steps.changed-files.outputs.all_changed_files }}" # read components as array readarray -t components < <(jq -c '.[]' "${{ inputs.input_file }}")