CI: add least-privilege permissions to GitHub Actions workflows #156
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: build | |
| on: [pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| actions: write | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| build: | |
| name: 🧪 Test & lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Commit message lint | |
| uses: wagoid/commitlint-github-action@v4 | |
| - name: Restore cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - 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 |