Skip to content

Commit

Permalink
improve lint workflow to avoid fast fail (#1378) (#1384)
Browse files Browse the repository at this point in the history
(cherry picked from commit e3116ca)

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent e28cb38 commit 305e037
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 305e037

Please sign in to comment.