From 6ba49e67f46c7a390fd0b1c11a39b7c1e08f5a13 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Mon, 10 Jun 2024 11:53:11 -0400 Subject: [PATCH] Code duplication: Update jscpd.yml to run in repo context (#11757) * Code duplication: Update jscpd.yml to run in repo context * Update jscpd.yml --- .github/workflows/jscpd.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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