diff --git a/.github/workflows/jscpd.yml b/.github/workflows/jscpd.yml index 4f75b098b9a..281a4e5e8ec 100644 --- a/.github/workflows/jscpd.yml +++ b/.github/workflows/jscpd.yml @@ -1,7 +1,7 @@ name: Check for Duplicated Code on: - pull_request: + pull_request_target: branches: - master @@ -40,8 +40,13 @@ jobs: - name: Run jscpd on entire codebase run: jscpd + - name: Fetch base and target branches + run: | + git fetch origin +refs/heads/${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} + git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge:refs/remotes/pull/${{ github.event.pull_request.number }}/merge + - name: Get the diff - run: git diff origin/master...HEAD --name-only > changed_files.txt + run: git diff --name-only origin/${{ github.event.pull_request.base.ref }}...refs/remotes/pull/${{ github.event.pull_request.number }}/merge > changed_files.txt - name: List generated files (debug) run: ls -l