Skip to content

Commit aa026b0

Browse files
authored
Enhance Maven workflow with permissions
Added permissions for dependency submission and updated comments.
1 parent dfade29 commit aa026b0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/maven.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
33

4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
94
name: Java CI with Maven
105

116
on:
@@ -14,6 +9,9 @@ on:
149
pull_request:
1510
branches: [ "main" ]
1611

12+
permissions:
13+
contents: write # required for dependency submission
14+
1715
jobs:
1816
build:
1917
runs-on: ubuntu-latest
@@ -30,8 +28,10 @@ jobs:
3028
- name: Build with Maven
3129
run: mvn -B -f SimpleAPI/pom.xml package
3230

31+
# Only run dependency graph submission on push (not pull_request)
3332
- name: Submit Dependency Snapshot
33+
if: github.event_name == 'push'
3434
uses: advanced-security/maven-dependency-submission-action@v5
3535
with:
36-
directory: SimpleAPI # <-- tell the action where pom.xml is
36+
directory: SimpleAPI # path to pom.xml
3737
# optional: maven-args: "-DskipTests"

0 commit comments

Comments
 (0)