|
| 1 | +# Security Notes |
| 2 | +# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions) |
| 3 | +# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions. |
| 4 | +# REVIEWERS, please always double-check security practices before merging a PR that contains workflow changes!! |
| 5 | +# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags. |
| 6 | + |
| 7 | +name: Linting and Tests |
| 8 | + |
| 9 | +# This workflow should run either on `merge_group`, `pull_request`, or `push` events |
| 10 | +# since we want to run lint checks against any changes on pull requests, or the final patch on merge groups |
| 11 | +# or if direct pushes happen to main (or when changes in general land on the `main` (default) branch) |
| 12 | +# Note that the reason why we run this on pushes against `main` is that on rare cases, maintainers might do direct pushes against `main` |
| 13 | + |
| 14 | +on: |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - main |
| 18 | + pull_request: |
| 19 | + branches: |
| 20 | + - main |
| 21 | + types: [opened, synchronize, reopened, ready_for_review] |
| 22 | + merge_group: |
| 23 | + |
| 24 | +# The permissions specified below apply to workflows triggered by `merge_group`, `push`, and `pull_request` events that originate from the same repository (non-fork). |
| 25 | +# However, workflows triggered by `pull_request` events from forked repositories are treated differently for security reasons: |
| 26 | +# - These workflows **do not** have access to any secrets configured in the repository. |
| 27 | +# - They are also **not granted any permissions** to perform actions on the base repository. |
| 28 | +# |
| 29 | +# This is a deliberate security restriction designed to prevent potential abuse through malicious pull requests from forks. |
| 30 | +# For a deeper explanation and best practices for securing your GitHub Actions workflows, particularly against so-called "pwn requests", |
| 31 | +# refer to https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ |
| 32 | +permissions: |
| 33 | + contents: read |
| 34 | + actions: read |
| 35 | + |
| 36 | +jobs: |
| 37 | + lint: |
| 38 | + name: Quality checks |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 44 | + |
| 45 | + - name: Setup Node.js |
| 46 | + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 |
| 47 | + with: |
| 48 | + node-version: lts/* |
| 49 | + cache: 'npm' |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: npm ci |
| 53 | + |
| 54 | + - name: Run quality checks |
| 55 | + run: node --run lint:fix && node --run format:check |
0 commit comments