Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
31 lines
673 B
YAML
31 lines
673 B
YAML
name: Check docs build
|
|
# This workflow runs when a PR is labeled with `docs`
|
|
# This will check if the docs build successfully by running `npm run build`
|
|
on:
|
|
pull_request:
|
|
types: [ labeled ]
|
|
paths:
|
|
- "docs/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-docs-build:
|
|
if: ${{ github.event.label.name == 'docs' }}
|
|
|
|
name: Check docs build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout 🛎️
|
|
uses: actions/checkout@v3
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Install dependencies and build docs 🧱
|
|
run: |
|
|
cd docs
|
|
npm install
|
|
npm run build
|