Skip to content

Commit

Permalink
Switch to a gha to get changed files
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Dec 21, 2023
1 parent 583f4dd commit 1b1480f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get list of changed files
id: files
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
git fetch origin $BASE_SHA
CHANGED_FILES=$(git diff --name-only $BASE_SHA...$HEAD_SHA | grep -E "\.(js|ts|tsx)$")
echo "::set-output name=changed::${CHANGED_FILES}"
- name: Get changed files
id: changed-files
uses: jitterbit/get-changed-files@v1
with:
format: 'json'

- name: Lint Changed Files
run: |
CHANGED_FILES="${{ steps.files.outputs.changed }}"
CHANGED_FILES="${{ steps.changed-files.outputs.all }}"
if [ -n "$CHANGED_FILES" ]; then
echo "Linting changed files..."
# Replace this with your linting command, making sure to pass in the changed files
yarn lint $CHANGED_FILES
else
echo "No JavaScript/TypeScript files to lint."
echo "No files to lint."
fi

0 comments on commit 1b1480f

Please sign in to comment.