Skip to content

Commit

Permalink
improve lint workflow to avoid fast fail (opensearch-project#1378)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <joshuali925@gmail.com>
  • Loading branch information
joshuali925 authored and sejli committed Jan 26, 2024
1 parent e363997 commit 2dcb16d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 2dcb16d

Please sign in to comment.