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: naveen <172697+naveensrinivasan@users.noreply.github.com>
33 lines
683 B
YAML
33 lines
683 B
YAML
name: Build Preview
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-preview:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
- run: npm ci
|
|
- run: npm run build-site
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: site
|
|
path: build/site
|
|
- name: Store pull request number for later use
|
|
run: |
|
|
mkdir -p build/pr
|
|
echo ${{github.event.number}} > build/pr/number
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pr
|
|
path: build/pr
|