Skip to content

Commit

Permalink
Add jitterbit for getting changed file and run lint
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Dec 20, 2023
1 parent 7abd2b8 commit c105885
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,24 @@ jobs:
run:
yarn osd bootstrap

- name: lint code base
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
# Step to get changed files
- name: Get changed files
id: changed-files
uses: jitterbit/get-changed-files@v1
with:
format: 'json'

# Step to lint changed JavaScript/TypeScript files
- name: Lint changed files
run: |
git fetch origin main
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/main | grep -E "\.(js|ts|tsx)$")
echo "here is the changed files: " $CHANGED_FILES
# Extract changed files as JSON
CHANGED_FILES_JSON='${{ steps.changed-files.outputs.all }}'
# Convert JSON to array of file paths
CHANGED_FILES=$(echo $CHANGED_FILES_JSON | jq -r '.[]' | grep -E "\.(js|ts|tsx)$")
echo "Changed JavaScript/TypeScript files:"
echo $CHANGED_FILES
if [ -n "$CHANGED_FILES" ]; then
echo "Linting changed files..."
yarn lint $CHANGED_FILES
else
echo "No JavaScript/TypeScript files changed."
fi

0 comments on commit c105885

Please sign in to comment.