@@ -25,26 +25,30 @@ concurrency:
2525jobs :
2626 dupe-check :
2727 runs-on : ubuntu-latest
28+ strategy :
29+ matrix :
30+ node-version : [18.x]
31+ env :
32+ NODE_OPTIONS : ' --max-old-space-size=8192'
2833
2934 steps :
3035 - name : Checkout code
3136 uses : actions/checkout@v4
3237 with :
3338 fetch-depth : 0
3439
35- - name : Set up Node.js
40+ - name : Set up Node.js ${{ matrix.node-version }}
3641 uses : actions/setup-node@v4
3742 with :
38- node-version : ' 18 '
43+ node-version : ${{ matrix.node-version }}
3944
40- - name : Set up Git
45+ - name : Fetch fork upstream
4146 run : |
4247 # Add the main repository as a remote
4348 git remote add forkUpstream https://github.com/${{ github.event.pull_request.head.repo.full_name }} # URL of the fork
4449 git fetch forkUpstream # Fetch fork
4550
46- - name : Get current branch and target branch
47- id : get_branches
51+ - name : Determine current and target branches
4852 run : |
4953 if [ "${{ github.event_name }}" == "pull_request" ]; then
5054 echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
7377 - name : Filter jscpd report for changed files
7478 run : |
7579 if [ ! -f ./jscpd-report.json ]; then
76- echo "jscpd-report.json not found"
77- exit 1
80+ echo "jscpd-report.json not found"
81+ exit 1
7882 fi
7983 echo "Filtering jscpd report for changed files..."
8084 CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' diff_output.txt)
9195 id : check_filtered_report
9296 run : |
9397 if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
94- echo "filtered_report_exists=true" >> $GITHUB_ENV
98+ echo "filtered_report_exists=true" >> $GITHUB_ENV
9599 else
96- echo "filtered_report_exists=false" >> $GITHUB_ENV
100+ echo "filtered_report_exists=false" >> $GITHUB_ENV
97101 fi
98102
99103 - name : Upload filtered jscpd report
@@ -106,6 +110,7 @@ jobs:
106110 - name : Fail if duplications are found
107111 if : env.filtered_report_exists == 'true'
108112 run : |
113+ cat ./filtered-jscpd-report.json
109114 echo "Duplications found, failing the check."
110115 exit 1
111116
0 commit comments