3232 NODE_OPTIONS : ' --max-old-space-size=8192'
3333
3434 steps :
35- - name : Checkout code
36- uses : actions/checkout@v4
35+ - uses : actions/checkout@v4
3736 with :
3837 fetch-depth : 0
3938
@@ -47,22 +46,17 @@ jobs:
4746 git remote add forkUpstream https://github.com/${{ github.event.pull_request.head.repo.full_name }} # URL of the fork
4847 git fetch forkUpstream # Fetch fork
4948
50- - name : Determine current and target branches
49+ - name : Determine base and target branches for comparison.
5150 run : |
5251 echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
5352 echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
54- - name : Get the diff
55- run : git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
56-
57- - name : Install dependencies
58- run : |
53+ - run : git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
54+ - run : |
5955 npm install -g jscpd diff-so-fancy
6056
61- - name : Run jscpd on entire codebase
62- run : jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
57+ - run : jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
6358
64- - name : Upload unfiltered jscpd report
65- if : always()
59+ - if : always()
6660 uses : actions/upload-artifact@v4
6761 with :
6862 name : unfiltered-jscpd-report
@@ -86,22 +80,20 @@ jobs:
8680 cat filtered-jscpd-report.json
8781
8882 - name : Check if filtered jscpd report exists
89- id : check_filtered_report
9083 run : |
9184 if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
9285 echo "filtered_report_exists=true" >> $GITHUB_ENV
9386 else
9487 echo "filtered_report_exists=false" >> $GITHUB_ENV
9588 fi
9689
97- - name : Upload filtered jscpd report
98- if : env.filtered_report_exists == 'true'
90+ - if : env.filtered_report_exists == 'true'
9991 uses : actions/upload-artifact@v4
10092 with :
10193 name : filtered-jscpd-report
10294 path : ./filtered-jscpd-report.json
10395
104- - name : Fail if duplications are found
96+ - name : Fail and log found duplicates.
10597 if : env.filtered_report_exists == 'true'
10698 run : |
10799 cat ./filtered-jscpd-report.json
0 commit comments