Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 65 additions & 2 deletions .github/workflows/build-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,68 @@
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
- name: Build with Gradle
run: ./gradlew build -x signPluginMavenPublication -i -Porg.gradle.java.installations.auto-download=false
- name: Build and publish to Maven Local with Gradle
run: ./gradlew build publishToMavenLocal -x signPluginMavenPublication -i -Porg.gradle.java.installations.auto-download=false
env:
DISABLE_REQUIRED_SIGNING: true
- name: Upload published plugin
uses: actions/upload-artifact@v4
with:
name: common-custom-user-data-gradle-plugin
path: ~/.m2/repository/com/gradle

local-test:
name: Test with Locally Published Plugin
runs-on: ubuntu-latest
needs: verification
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
- name: Download plugin to maven local
uses: actions/download-artifact@v4
with:
name: common-custom-user-data-gradle-plugin
path: ~/.m2/repository/com/gradle
- name: Create a test project
run: |
echo """
pluginManagement {
repositories {
gradlePluginPortal()
exclusiveContent {
forRepository {
mavenLocal()
}
filter {
includeModule(\"com.gradle\", \"common-custom-user-data-gradle-plugin\")
includeModule(\"com.gradle.common-custom-user-data-gradle-plugin\", \"com.gradle.common-custom-user-data-gradle-plugin.gradle.plugin\")
}
}
}
}
plugins {
id(\"com.gradle.develocity\") version \"4+\"
id(\"com.gradle.common-custom-user-data-gradle-plugin\") version \"2+\"
}
develocity {
server = \"https://ge.solutions-team.gradle.com\"
}
rootProject.name = \"ccud-gradle-integration-test\"
""" > ${{ runner.temp }}/settings.gradle.kts
- name: Run a build with the locally published plugin
id: build-with-local-plugin
run: gradle help
working-directory: ${{ runner.temp }}
Comment on lines +32 to +85

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 months ago

To resolve this issue, we should add an explicit permissions block at the root of the workflow and/or for specific jobs. Since the jobs in this workflow mainly interact with artifacts, Gradle, and Maven, the required permissions are minimal. For instance:

  1. Add contents: read to allow the workflow to read repository contents if necessary.
  2. Add other permissions only if required for the workflow to function correctly.

The permissions block can be added at the top level of the workflow file to apply to all jobs by default or specified individually for each job. In this case, we will add a permissions block at the root level to ensure all jobs share the same minimal permissions.


Suggested changeset 1
.github/workflows/build-verification.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build-verification.yml b/.github/workflows/build-verification.yml
--- a/.github/workflows/build-verification.yml
+++ b/.github/workflows/build-verification.yml
@@ -2,6 +2,9 @@
 
 on: [ push, pull_request, workflow_dispatch ]
 
+permissions:
+  contents: read
+
 jobs:
   verification:
     name: Verification
EOF
@@ -2,6 +2,9 @@

on: [ push, pull_request, workflow_dispatch ]

permissions:
contents: read

jobs:
verification:
name: Verification
Copilot is powered by AI and may make mistakes. Always verify output.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ You may also remove `plugin-publish` and `signing` from the `plugins {}` block a

signing {
// Require publications to be signed on CI. Otherwise, publication will be signed only if keys are provided.
isRequired = providers.environmentVariable("CI").isPresent
isRequired = providers.environmentVariable("CI").isPresent &&
providers.environmentVariable("DISABLE_REQUIRED_SIGNING").isPresent.not()

useInMemoryPgpKeys(
providers.environmentVariable("PGP_SIGNING_KEY").orNull,
Expand Down
Loading