added security best practises #412
Workflow file for this run
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: AST Javascript wrapper CI | |
| on: [ pull_request ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-tests: | |
| runs-on: cx-public-ubuntu-x64 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Verify single lockfile (Step 0 - Supply Chain Policy) | |
| run: | | |
| if [ -f yarn.lock ] && [ -f package-lock.json ]; then | |
| echo "❌ ERROR: Both yarn.lock and package-lock.json found. Policy requires exactly ONE package manager. Allowed: npm + package-lock.json OR Yarn + yarn.lock" | |
| exit 1 | |
| fi | |
| if [ ! -f yarn.lock ] && [ ! -f package-lock.json ]; then | |
| echo "❌ ERROR: No lockfile found. Policy requires exactly ONE package manager lockfile. Required: npm + package-lock.json OR Yarn + yarn.lock" | |
| exit 1 | |
| fi | |
| - name: Use Node.js 22.11.0 | |
| uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
| with: | |
| node-version: 22.11.0 | |
| registry-url: https://npm.pkg.github.com/ | |
| - run: npm ci --ignore-scripts | |
| - name: Run Unit Tests | |
| run: npm run test:unit | |
| integration-tests: | |
| runs-on: cx-public-ubuntu-x64 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Verify single lockfile (Step 0 - Supply Chain Policy) | |
| run: | | |
| if [ -f yarn.lock ] && [ -f package-lock.json ]; then | |
| echo "❌ ERROR: Both yarn.lock and package-lock.json found. Policy requires exactly ONE package manager. Allowed: npm + package-lock.json OR Yarn + yarn.lock" | |
| exit 1 | |
| fi | |
| if [ ! -f yarn.lock ] && [ ! -f package-lock.json ]; then | |
| echo "❌ ERROR: No lockfile found. Policy requires exactly ONE package manager lockfile. Required: npm + package-lock.json OR Yarn + yarn.lock" | |
| exit 1 | |
| fi | |
| - name: Use Node.js 22.11.0 | |
| uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
| with: | |
| node-version: 22.11.0 | |
| registry-url: https://npm.pkg.github.com/ | |
| - run: npm ci --ignore-scripts | |
| - name: Code Linting | |
| run: npm run lint | |
| - run: npm run build --if-present | |
| - name: Run tests | |
| env: | |
| CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID}} | |
| CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET}} | |
| CX_BASE_URI: ${{ secrets.CX_BASE_URI }} | |
| CX_TENANT: ${{ secrets.CX_TENANT }} | |
| CX_APIKEY: ${{ secrets.CX_APIKEY }} | |
| run: npm test |