Skip to content

Commit

Permalink
Add lint for pr 1
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 acdee6a commit 999dadc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Lint

on:
pull_request_target:
types: [opened, synchronize, reopened]
on: [push, pull_request]

env:
PLUGIN_NAME: dashboards-observability
Expand Down Expand Up @@ -51,15 +49,20 @@ jobs:
yarn osd bootstrap

- name: Checkout the head of the pull request
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get list of changed files
id: files
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD ${{ github.base_ref }}) | grep -E "\.(js|ts|tsx)$")
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD ${{ github.base_ref }}) | grep -E "\.(js|ts|tsx)$")
else
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E "\.(js|ts|tsx)$")
fi
echo "::set-output name=changed::${CHANGED_FILES}"
- name: Lint Changed Files
Expand Down

0 comments on commit 999dadc

Please sign in to comment.