f957e3c051
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> Closes gh-11367
33 lines
745 B
YAML
33 lines
745 B
YAML
name: PR Build
|
|
|
|
on: pull_request
|
|
|
|
env:
|
|
RUN_JOBS: ${{ github.repository == 'spring-projects/spring-security' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- if: env.RUN_JOBS == 'true'
|
|
uses: actions/checkout@v2
|
|
- name: Set up JDK
|
|
if: env.RUN_JOBS == 'true'
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '11'
|
|
- name: Setup Gradle
|
|
if: env.RUN_JOBS == 'true'
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
cache-read-only: true
|
|
env:
|
|
GRADLE_USER_HOME: ~/.gradle
|
|
- name: Build with Gradle
|
|
if: env.RUN_JOBS == 'true'
|
|
run: ./gradlew clean build --continue --scan
|