Run code analyze triggered with pull request by BHyeonKim #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Analyze Pull Request | |
| run-name: Run code analyze triggered with pull request by ${{github.actor}} | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| branches: | |
| - main | |
| - develop | |
| env: | |
| NODE_VERSION: 18.12.0 | |
| jobs: | |
| code_analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 'Checkout repository on branch: ${{ github.REF }}' | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.HEAD_REF }} | |
| - name: Retrieve entire repository history | |
| run: | | |
| git fetch --prune --unshallow | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| id: npm-cache | |
| with: | |
| path: '**/node_modules' | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install Dependencies | |
| if: steps.npm-cache.outputs.cache-hit != 'true' | |
| run: npm install | |
| - name: Coverage Test | |
| continue-on-error: true | |
| run: npm run coverage | |
| - name: Run an analysis of the ${{ github.REF }} branch ${{ github.BASE_REF }} base | |
| uses: sonarsource/sonarqube-scan-action@master | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |