From 2dcb16da831cf12e2385e4333e16a58ef343a8dd Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 24 Jan 2024 13:02:32 -0800 Subject: [PATCH] improve lint workflow to avoid fast fail (#1378) Signed-off-by: Joshua Li --- .github/workflows/lint.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 22d20d68d..9d996b8b7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -62,18 +62,12 @@ jobs: - name: Lint Changed Files run: | - jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | sort | uniq > /tmp/changed_files.txt - CHANGED_FILES=$(cat /tmp/changed_files.txt) - echo "These are the changed files: $CHANGED_FILES" + CHANGED_FILES=($(jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | grep '.\+.\(js\|ts\|tsx\)$' | sort -u)) if [[ -n "$CHANGED_FILES" ]]; then - echo "Linting changed files..." - while IFS= read -r file; do - if [[ $file == *.js || $file == *.ts || $file == *.tsx ]]; then - echo "linting file $file" - yarn lint "$file" - fi - done < /tmp/changed_files.txt + echo 'These are the changed files:' + printf '%s\n' "${CHANGED_FILES[@]}" + yarn lint "${CHANGED_FILES[@]}" else echo "No matched files to lint." fi - working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} + working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}