Skip to content

Commit

Permalink
Add true and split into array
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Dec 21, 2023
1 parent 165b0fc commit e726b9a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ jobs:
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
git fetch origin $BASE_SHA
git diff --name-only $BASE_SHA...$HEAD_SHA > changed_files.txt
CHANGED_FILES=$(cat changed_files.txt | grep -E '\.(js|ts|tsx)$')
CHANGED_FILES=$(cat changed_files.txt | grep -E '\.(js|ts|tsx)$' || true)
echo "::set-output name=changed::${CHANGED_FILES}"
- name: Lint Changed Files
run: |
CHANGED_FILES="${{ steps.files.outputs.changed }}"
if [ -n "$CHANGED_FILES" ]; then
if [[ -n "$CHANGED_FILES" && "$CHANGED_FILES" != "" ]]; then
echo "Linting changed files..."
yarn lint $CHANGED_FILES
IFS=$'\n' read -r -a FILES_TO_LINT <<< "$CHANGED_FILES"
yarn lint "${FILES_TO_LINT[@]}"
else
echo "No JavaScript/TypeScript files to lint."
fi
Expand Down

0 comments on commit e726b9a

Please sign in to comment.