Skip to content

Commit 6ba49e6

Browse files
authored
Code duplication: Update jscpd.yml to run in repo context (#11757)
* Code duplication: Update jscpd.yml to run in repo context * Update jscpd.yml
1 parent 7bdab2b commit 6ba49e6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/jscpd.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Check for Duplicated Code
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches:
66
- master
77

@@ -40,8 +40,13 @@ jobs:
4040
- name: Run jscpd on entire codebase
4141
run: jscpd
4242

43+
- name: Fetch base and target branches
44+
run: |
45+
git fetch origin +refs/heads/${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }}
46+
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge:refs/remotes/pull/${{ github.event.pull_request.number }}/merge
47+
4348
- name: Get the diff
44-
run: git diff origin/master...HEAD --name-only > changed_files.txt
49+
run: git diff --name-only origin/${{ github.event.pull_request.base.ref }}...refs/remotes/pull/${{ github.event.pull_request.number }}/merge > changed_files.txt
4550

4651
- name: List generated files (debug)
4752
run: ls -l

0 commit comments

Comments
 (0)