Skip to content

Conversation

@mwwoda
Copy link
Contributor

@mwwoda mwwoda commented Sep 12, 2025

  • add cron job to run tests at 3:20 AM CET.

Looks like we don't need to adjust coveralls, as it should report coverage of the currently check out branch locally (tested locally - https://coveralls.io/github/box/box-java-sdk-gen?branch=test-branch

Comment on lines +7 to +48
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
distribution: ["zulu", "temurin"]
java: ["8", "17"]
name: Java ${{ matrix.java }} (${{ matrix.distribution }})
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: sdk-gen
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: "gradle"
- name: All Tests
env:
JWT_CONFIG_BASE_64: ${{ secrets.JWT_CONFIG_BASE_64 }}
ADMIN_USER_ID: ${{ secrets.ADMIN_USER_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
USER_ID: ${{ secrets.USER_ID }}
ENTERPRISE_ID: ${{ secrets.ENTERPRISE_ID }}
BOX_FILE_REQUEST_ID: ${{ secrets.BOX_FILE_REQUEST_ID }}
BOX_EXTERNAL_USER_EMAIL: ${{ secrets.BOX_EXTERNAL_USER_EMAIL }}
BOX_EXTERNAL_USER_ID: ${{ secrets.BOX_EXTERNAL_USER_ID }}
APP_ITEM_ASSOCIATION_FILE_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FILE_ID }}
APP_ITEM_ASSOCIATION_FOLDER_ID: ${{ secrets.APP_ITEM_ASSOCIATION_FOLDER_ID }}
WORKFLOW_FOLDER_ID: ${{ secrets.WORKFLOW_FOLDER_ID }}
APP_ITEM_SHARED_LINK: ${{ secrets.APP_ITEM_SHARED_LINK }}
SLACK_AUTOMATION_USER_ID: ${{ secrets.SLACK_AUTOMATION_USER_ID }}
SLACK_ORG_ID: ${{ secrets.SLACK_ORG_ID }}
SLACK_PARTNER_ITEM_ID: ${{ secrets.SLACK_PARTNER_ITEM_ID }}
run: ./gradlew check --stacktrace
- name: Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew jacocoTestReport coverallsJacoco
notify:

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 address the issue, you should explicitly set the permissions block in your GitHub Actions workflow. This can be done at the workflow (top) level, which will apply to all jobs unless overridden, or at the individual job level if different jobs require different permissions. Since neither shown job appears to need write permissions, adding permissions: contents: read at the workflow level is both safe and sufficient. This will restrict the GITHUB_TOKEN to read-only permission for the repository contents (the minimal privilege for most workflows). Place this block immediately after the name and before the on: key at the top of the file. No additional YAML imports or definitions are required.


Suggested changeset 1
.github/workflows/build-and-test-daily.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-and-test-daily.yml b/.github/workflows/build-and-test-daily.yml
--- a/.github/workflows/build-and-test-daily.yml
+++ b/.github/workflows/build-and-test-daily.yml
@@ -1,4 +1,6 @@
 name: Build and Test daily (sdk-gen)
+permissions:
+  contents: read
 on:
   schedule:
     - cron: "20 1 * * 1-5"
EOF
@@ -1,4 +1,6 @@
name: Build and Test daily (sdk-gen)
permissions:
contents: read
on:
schedule:
- cron: "20 1 * * 1-5"
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines 49 to 67
name: Send Slack Notification
runs-on: ubuntu-latest
needs: [build-and-test]
if: always()
steps:
- name: Send Slack Notification
env:
SLACK_WEBHOOK_TEST_NOTIFICATION_URL: ${{ secrets.SLACK_WEBHOOK_TEST_NOTIFICATION_URL }}
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ "${{ needs.build-and-test }}" != "success" ]; then
STATUS="Failure ❌"
else
STATUS="Success ✅"
fi

curl -X POST -H "Content-Type: application/json" \
--data "{\"text\":\"<${BUILD_URL}|Daily Tests Job> in *${GITHUB_REPOSITORY}* finished with status: ${STATUS}\"}" \
"$SLACK_WEBHOOK_TEST_NOTIFICATION_URL

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: {}

Copilot Autofix

AI 4 months ago

To fix the problem, explicitly specify the minimal permissions the job requires by adding permissions: at the job level. In this case, the notify job does not use the GITHUB_TOKEN, nor does it need any API access, so the permissions: none value is appropriate. This line should be added in the job definition before any steps, typically immediately after runs-on: ubuntu-latest. Only .github/workflows/build-and-test-daily.yml is affected.


Suggested changeset 1
.github/workflows/build-and-test-daily.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-and-test-daily.yml b/.github/workflows/build-and-test-daily.yml
--- a/.github/workflows/build-and-test-daily.yml
+++ b/.github/workflows/build-and-test-daily.yml
@@ -48,6 +48,7 @@
   notify:
     name: Send Slack Notification
     runs-on: ubuntu-latest
+    permissions: none
     needs: [build-and-test]
     if: always()
     steps:
EOF
@@ -48,6 +48,7 @@
notify:
name: Send Slack Notification
runs-on: ubuntu-latest
permissions: none
needs: [build-and-test]
if: always()
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
@coveralls
Copy link

coveralls commented Sep 12, 2025

Pull Request Test Coverage Report for Build #4822

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 72.044%

Files with Coverage Reduction New Missed Lines %
src/main/java/com/box/sdk/RealtimeServerConnection.java 1 77.78%
Totals Coverage Status
Change from base Build #4806: -0.004%
Covered Lines: 8213
Relevant Lines: 11400

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build #4813

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 72.044%

Files with Coverage Reduction New Missed Lines %
src/main/java/com/box/sdk/RealtimeServerConnection.java 1 77.78%
Totals Coverage Status
Change from base Build #4806: -0.004%
Covered Lines: 8213
Relevant Lines: 11400

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build #4815

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.048%

Totals Coverage Status
Change from base Build #4806: 0.0%
Covered Lines: 8220
Relevant Lines: 11409

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build #4812

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.048%

Totals Coverage Status
Change from base Build #4806: 0.0%
Covered Lines: 8220
Relevant Lines: 11409

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build #4814

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.048%

Totals Coverage Status
Change from base Build #4806: 0.0%
Covered Lines: 8220
Relevant Lines: 11409

💛 - Coveralls

@mwwoda mwwoda merged commit 6857272 into main Sep 12, 2025
12 of 13 checks passed
@mwwoda mwwoda deleted the sdk-5113-add-test-cron-job branch September 12, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants