Skip to content

Commit bce338f

Browse files
committed
seperate into two steps
1 parent ddec34d commit bce338f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/node.js.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,18 @@ jobs:
4444
- name: Run jscpd on entire codebase
4545
run: jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
4646

47+
- name: Get current branch and target branch
48+
id: get_branches
49+
run: |
50+
if [ "${{ github.event_name }}" == "pull_request" ]; then
51+
echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
52+
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
53+
else
54+
echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
55+
echo "TARGET_BRANCH=master" >> $GITHUB_ENV # Default target branch
56+
fi
4757
- name: Get the diff
48-
run: git diff --name-only origin/${{ github.event.pull_request.base.ref }}..${{ github.head_ref }} >> diff_output.txt
58+
run: git diff --name-only origin/$TARGET_BRANCH $CURRENT_BRANCH > diff_output.txt
4959

5060
- name: Upload unfiltered jscpd report
5161
if: always()

0 commit comments

Comments
 (0)