Skip to content

CI: add least-privilege permissions to GitHub Actions workflows #163

CI: add least-privilege permissions to GitHub Actions workflows

CI: add least-privilege permissions to GitHub Actions workflows #163

Workflow file for this run

name: build
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
build:
name: 🧪 Test & lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Commit message lint
uses: wagoid/commitlint-github-action@v6
- name: Restore cache
uses: actions/cache@v5
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Repair moderation test policy
env:
STREAM_KEY: ${{ secrets.STREAM_KEY }}
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
run: |
npm install --prefix "$RUNNER_TEMP/moderation-repair" --no-save --package-lock=false --ignore-scripts @stream-io/node-sdk@0.8.3
NODE_PATH="$RUNNER_TEMP/moderation-repair/node_modules" node .github/scripts/repair-moderation-policy.cjs
- name: Test
env:
STREAM_KEY: ${{ secrets.STREAM_KEY }}
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
STREAM_APP_ID: ${{ secrets.STREAM_APP_ID }}
run: |
./gradlew spotlessCheck --no-daemon
./gradlew test --no-daemon