Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 53 additions & 14 deletions .github/workflows/on_pr_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,70 @@ on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
linter:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 18
- run: npm ci
- run: npm run lint

test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 18
- run: npm ci
- run: npm run test

scan:
runs-on: ubuntu-latest
# Skip for dependabot PRs and forks
if: >-
github.actor != 'dependabot[bot]'
&& (github.event_name == 'push'
|| github.event.pull_request.head.repo.full_name == github.repository)
env:
MEND_EMAIL: ${{secrets.MEND_EMAIL}}
MEND_USER_KEY: ${{secrets.MEND_USER_KEY}}
MEND_URL: ${{secrets.MEND_URL}}
MEND_ORGNAME: ${{secrets.MEND_ORGNAME}}
MEND_PRODUCTNAME: ${{secrets.MEND_PRODUCTNAME}}
MEND_PROJECTNAME: ${{secrets.MEND_PROJECTNAME}}
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- name: Download Mend CLI
run: |
curl -sSf https://downloads.mend.io/cli/linux_amd64/mend -o /usr/local/bin/mend
chmod +x /usr/local/bin/mend
- name: Mend baseline scan
if: github.event_name == 'push'
run: |
echo Run Mend dependencies scan
mend dep --dir . --scope "$MEND_ORGNAME//$MEND_PRODUCTNAME//$MEND_PROJECTNAME" --export-results "mend_report.json" --update
echo Run Mend code scan
mend code --dir . --scope "$MEND_ORGNAME//$MEND_PRODUCTNAME//$MEND_PROJECTNAME" --report --formats "csv,html" --filename "mend_report"
- name: Mend PR scan
if: github.event_name == 'pull_request'
env:
HEAD_REF: ${{ github.head_ref }}
run: |
# Branch names might contain slashes
SAFE_REF="${HEAD_REF//\//-}"
echo Run Mend code scan
mend code --dir . --scope "$MEND_ORGNAME//$MEND_PRODUCTNAME//${MEND_PROJECTNAME}_${SAFE_REF}" --report --formats "csv,html" --filename "mend_report"
Loading