code-scan.yml 1.79 KB
Newer Older
ransome1's avatar
ransome1 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
name: Code scan on branch push and mirror to opencode.net
on:
  push:
    branches:
      - '*'
jobs:
  snyk:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Run Snyk to check for vulnerabilities
      uses: snyk/actions/node@master
      env:
        SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}  
  njsscan:
16
    needs: snyk
ransome1's avatar
ransome1 committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    name: njsscan
    runs-on: ubuntu-latest
    steps:
    - name: Checkout the code
      uses: actions/checkout@v2
    - name: nodejsscan scan
      id: njsscan
      uses: ajinabraham/njsscan-action@master
      with:
        args: '. --sarif --output results.sarif || true'
    - name: Upload njsscan report
      uses: github/codeql-action/upload-sarif@v1
      with:
        sarif_file: results.sarif
  codeql:
    needs: njsscan
    name: CodeQL
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        language: [ 'javascript' ]
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v1
      with:
        languages: ${{ matrix.language }}
    - name: Autobuild
      uses: github/codeql-action/autobuild@v1
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v1
  mirror:
    name: Mirror code to opencode.net
    runs-on: ubuntu-latest
    needs: codeql
    steps:                                              # <-- must use actions/checkout@v2 before mirroring!
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: pixta-dev/repository-mirroring-action@v1
      with:
        target_repo_url:
          git@www.opencode.net:ransome/sleek.git
        ssh_private_key:                                # <-- use 'secrets' to pass credential information.
          ${{ secrets.GITLAB_SSH_PRIVATE_KEY }}