- 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/) 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. Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: "Branch build"
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- main
|
|
- develop
|
|
- release/*
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
install-notest:
|
|
if: "github.repository != 'WebGoat/WebGoat'"
|
|
runs-on: ubuntu-latest
|
|
name: "Package and linting"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: set up JDK 17
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 17
|
|
architecture: x64
|
|
- name: Cache Maven packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2
|
|
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ubuntu-latest-m2
|
|
- name: Test with Maven
|
|
run: mvn --no-transfer-progress install -DskipTests
|
|
|
|
testing:
|
|
if: "github.repository != 'WebGoat/WebGoat'"
|
|
needs: install-notest
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
args:
|
|
- mvn --no-transfer-progress -pl '!webgoat-integration-tests' test
|
|
- mvn --no-transfer-progress -pl webgoat-integration-tests test
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: set up JDK 17
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 17
|
|
architecture: x64
|
|
- name: Cache Maven packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2
|
|
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ubuntu-latest-m2
|
|
- name: Test with Maven
|
|
run: ${{ matrix.args }}
|