Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Jan 5, 2024
1 parent cf672ef commit 2dfde77
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,22 @@ jobs:
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
run: yarn osd bootstrap

- name: Get list of changed files
- name: Get list of changed files using GitHub Action
uses: lots0logs/[email protected]
id: files
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
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)$' || true)
echo "::set-output name=changed::${CHANGED_FILES}"
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
with:
format: 'space-delimited'
filters: |
added: .*\.(js|ts|tsx)$
modified: .*\.(js|ts|tsx)$
- name: Lint Changed Files
run: |
CHANGED_FILES="${{ steps.files.outputs.changed }}"
CHANGED_FILES="${{ steps.files.outputs.all }}"
echo "These are the files to be lint: $CHANGED_FILES"
if [[ -n "$CHANGED_FILES" ]]; then
echo "Linting changed files..."
IFS=$'\n' read -r -a FILES_TO_LINT <<< "$CHANGED_FILES"
IFS=' ' read -r -a FILES_TO_LINT <<< "$CHANGED_FILES"
yarn lint "${FILES_TO_LINT[@]}"
else
echo "No matched files to lint."
Expand Down

0 comments on commit 2dfde77

Please sign in to comment.