Conversation
❌ Deploy Preview for javabooksdocs failed.
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: set up JDK 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '11' | ||
| distribution: 'temurin' | ||
| cache: gradle | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
| - name: Build with Gradle | ||
| run: ./gradlew build |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 11 hours ago
To fix the problem, add an explicit permissions block that grants only the minimum required scopes to the GITHUB_TOKEN. Since this workflow checks out code and runs Gradle locally, contents: read is sufficient and matches the recommendation.
The best way to fix this without changing existing functionality is to add permissions: contents: read at the job level under build: (so it applies only to this job) or at the workflow root. Because CodeQL highlighted the job’s runs-on line, we will set the permissions for that specific job. Concretely, edit .github/workflows/android.yml and insert a permissions: section between build: and runs-on: ubuntu-latest, with two-space indentation under build: and four-space indentation for contents: read.
No additional methods, imports, or definitions are needed—this is purely a declarative change in the workflow YAML.
| @@ -8,7 +8,8 @@ | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: |
No description provided.