From 2cf13a0f6e235c6f0e4d5b1448a99007121999e8 Mon Sep 17 00:00:00 2001 From: Alexey Alter-Pesotskiy Date: Fri, 4 Dec 2026 14:57:49 +0000 Subject: [PATCH 1/2] ci: add Dependabot and dependency review, pin GitHub Actions --- .github/dependabot.yml | 25 +++++++++++ .github/workflows/breaking_changes.yml | 6 +-- .github/workflows/ci.yml | 2 +- .github/workflows/dependency_review.yml | 20 +++++++++ .github/workflows/dependency_submission.yml | 50 +++++++++++++++++++++ .github/workflows/pr_title.yml | 2 +- .github/workflows/regen.yml | 10 ++--- .github/workflows/release.yml | 18 ++++---- .github/workflows/run_integration.yml | 8 ++-- .github/workflows/run_tests.yml | 8 ++-- 10 files changed, 122 insertions(+), 27 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/dependency_review.yml create mode 100644 .github/workflows/dependency_submission.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..b7a566fc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +version: 2 + +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + cooldown: + default-days: 4 + groups: + github-actions: + patterns: ["*"] + commit-message: + prefix: chore + include: scope + + # Version updates are off for Gradle dependencies: only security updates are proposed. + - package-ecosystem: gradle + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 0 + commit-message: + prefix: chore + include: scope diff --git a/.github/workflows/breaking_changes.yml b/.github/workflows/breaking_changes.yml index d7570040..36e8eef9 100644 --- a/.github/workflows/breaking_changes.yml +++ b/.github/workflows/breaking_changes.yml @@ -103,17 +103,17 @@ jobs: echo "::error::$new brings approved breaking changes (${added//$'\n'/, }). Add '!' to the PR title to release a major, or label the PR sdk-not-breaking and name each ticket in the PR body if none of them breaks this SDK. $hold" exit 1 # A hand-written change never moves .spec-version, so the public API itself is compared too, with japicmp on jars built from the base tip and the merge commit. - - uses: actions/checkout@v5.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 if: ${{ !cancelled() }} with: fetch-depth: 2 persist-credentials: false - - uses: actions/setup-java@v5.1.0 + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 if: ${{ !cancelled() }} with: distribution: 'corretto' java-version: '17' - - uses: gradle/actions/setup-gradle@v4 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 if: ${{ !cancelled() }} - name: Public API stays compatible if: ${{ !cancelled() }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9615ba97..4813bb59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: name: 🧪 Tests needs: [release-only, unit] if: ${{ !cancelled() }} - runs-on: { group: github-public-amd64 } + runs-on: ubuntu-26.04 timeout-minutes: 5 steps: - name: Check the unit lane diff --git a/.github/workflows/dependency_review.yml b/.github/workflows/dependency_review.yml new file mode 100644 index 00000000..f04cc058 --- /dev/null +++ b/.github/workflows/dependency_review.yml @@ -0,0 +1,20 @@ +name: Dependency Review + +on: + pull_request: + +permissions: + contents: read + +jobs: + dependency-review: + name: Dependency Review + runs-on: + group: github-public-amd64 + timeout-minutes: 5 + steps: + - name: Dependency Review + uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1 + with: + show-openssf-scorecard: true + warn-on-openssf-scorecard-level: 3 diff --git a/.github/workflows/dependency_submission.yml b/.github/workflows/dependency_submission.yml new file mode 100644 index 00000000..98927444 --- /dev/null +++ b/.github/workflows/dependency_submission.yml @@ -0,0 +1,50 @@ +name: Dependency Submission + +on: + push: + branches: [main] + pull_request: + paths: + - .github/workflows/dependency_submission.yml + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dependency-submission: + name: Dependency Submission + # A pull request from a fork gets a read-only token, which cannot submit. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + # The submission goes through the GitHub API, so the job needs the paid runner group. + runs-on: + group: github-public-amd64 + timeout-minutes: 15 + permissions: + contents: write + steps: + - name: Check out code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Setup JDK 17 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: 'corretto' + java-version: '17' + + # GitHub cannot read Gradle dependencies from the build files, so Gradle resolves them and submits the list. + - name: Generate and submit the dependency graph + uses: gradle/actions/dependency-submission@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 + with: + dependency-graph: generate-and-submit + # Only what the published library ships: its runtime classpath, without the test classpaths and the + # build tooling. Alerts for anything else would not be about the SDK. + dependency-graph-include-configurations: runtimeClasspath + # This job has its own cache entry, which nothing else would read. + cache-read-only: true diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index cfd6193e..f01dd538 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -12,6 +12,6 @@ jobs: name: 👮 Conventional PR title runs-on: { group: github-public-amd64 } steps: - - uses: amannn/action-semantic-pull-request@v6 + - uses: amannn/action-semantic-pull-request@66e72920af32222769c386d81f89656ebcb6d6d5 # v6.1.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml index 06d314b4..18ca6474 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -41,7 +41,7 @@ jobs: statuses: read steps: - id: app - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: Iv23lioh9qYGjBIp9nsK private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} @@ -49,23 +49,23 @@ jobs: permission-pull-requests: write # Read-only, for the generator on the chat release and the protocol release list. - id: read - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: Iv23lioh9qYGjBIp9nsK private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} repositories: chat,protocol permission-contents: read - - uses: actions/checkout@v5.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # The branch tip, not the commit of the event: a run queued behind another one must see the regen that one merged. ref: ${{ github.ref }} token: ${{ steps.app.outputs.token }} # generate.sh formats and compiles the generated sources. - - uses: actions/setup-java@v5.1.0 + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: distribution: 'corretto' java-version: '17' - - uses: gradle/actions/setup-gradle@v4 + - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Regenerate and open the PR id: regen env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cff8fec2..a7e2f387 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,13 +58,13 @@ jobs: steps: - id: app if: github.ref_name == github.event.repository.default_branch - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: Iv23lioh9qYGjBIp9nsK private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} permission-contents: write permission-pull-requests: write - - uses: googleapis/release-please-action@v4 + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 with: token: ${{ steps.app.outputs.token || github.token }} config-file: release-please-config.json @@ -205,7 +205,7 @@ jobs: release_created: ${{ steps.release.outputs.release_created }} tag_name: ${{ steps.release.outputs.tag_name }} steps: - - uses: googleapis/release-please-action@v4 + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 id: release with: config-file: release-please-config.json @@ -242,7 +242,7 @@ jobs: tag="${PUBLISH_TAG:-$RELEASE_TAG}" echo "tag=${tag}" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@v5.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # refs/tags/ so that a publish_tag naming a branch or a SHA is not checked out. ref: refs/tags/${{ steps.target.outputs.tag }} @@ -280,13 +280,13 @@ jobs: echo "Tag ${TAG} (${commit}) is on ${GITHUB_REF_NAME}." - name: Setup JDK 17 - uses: actions/setup-java@v5.1.0 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: distribution: 'corretto' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 # An env var rather than -P, so a value with a space cannot split into a second argument. - name: Select publish targets @@ -322,7 +322,7 @@ jobs: # directory instead of writing to the bucket itself. - name: Hand the staged tree to the upload job if: ${{ contains(env.PUBLISH_TARGETS, 'streamRepo') }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: stream-repo-staged path: build/staged-repo @@ -344,13 +344,13 @@ jobs: contents: read steps: - name: Download the staged tree - uses: actions/download-artifact@v4 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: stream-repo-staged path: build/staged-repo - name: Publish to the Stream repository - uses: GetStream/stream-build-conventions-android/.github/actions/publish-to-stream-repo@v1.0.1 + uses: GetStream/stream-build-conventions-android/.github/actions/publish-to-stream-repo@d275481d345e4b3b1252006dbb6cf029c9e32767 # v1.0.1 with: staged-directory: build/staged-repo channel: releases diff --git a/.github/workflows/run_integration.yml b/.github/workflows/run_integration.yml index ddcb2156..f42fc084 100644 --- a/.github/workflows/run_integration.yml +++ b/.github/workflows/run_integration.yml @@ -22,22 +22,22 @@ jobs: integration: name: 🧪 Integration tests environment: ci - runs-on: { group: github-public-amd64 } + runs-on: ubuntu-26.04 timeout-minutes: 30 steps: - name: Check out code - uses: actions/checkout@v5.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup JDK 17 - uses: actions/setup-java@v5.1.0 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: distribution: 'corretto' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Integration tests env: diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index dac1b1de..85721e2d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -16,22 +16,22 @@ permissions: jobs: test: name: 🧪 Test & lint - runs-on: { group: github-public-amd64 } + runs-on: ubuntu-26.04 timeout-minutes: 20 steps: - name: Check out code - uses: actions/checkout@v5.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup JDK 17 - uses: actions/setup-java@v5.1.0 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: distribution: 'corretto' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - name: Test run: | From 97f804b0553743c3153f50e1af49f5d42f314af0 Mon Sep 17 00:00:00 2001 From: Alexey Alter-Pesotskiy Date: Fri, 4 Dec 2026 19:19:38 +0000 Subject: [PATCH 2/2] ci: run dependency review after the Gradle dependency submission Submit the Gradle dependencies on every pull request and run Dependency Review after the submission, as jobs of one workflow. GitHub caches the comparison it returns per request, so a review that asks before the submission is in keeps getting the answer without the Gradle dependencies. --- .github/workflows/dependency_review.yml | 69 +++++++++++++++++++++ .github/workflows/dependency_submission.yml | 50 --------------- 2 files changed, 69 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/dependency_submission.yml diff --git a/.github/workflows/dependency_review.yml b/.github/workflows/dependency_review.yml index f04cc058..fda56e97 100644 --- a/.github/workflows/dependency_review.yml +++ b/.github/workflows/dependency_review.yml @@ -2,13 +2,82 @@ name: Dependency Review on: pull_request: + # Pushes to main only submit the Gradle dependencies, which is what Dependabot alerts read. + push: + branches: [main] + workflow_dispatch: permissions: contents: read +concurrency: + # Every commit on main keeps its own run: a commit without a submitted list makes all Gradle dependencies of + # the next pull request look newly added. A pull request only needs its latest commit. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: + gradle-dependencies: + name: Resolve the Gradle dependencies + # Resolving needs no GitHub token, so it does not need the runner group that the other two jobs need. + runs-on: ubuntu-26.04 + timeout-minutes: 15 + env: + # GitHub replaces an earlier list only when this name is the same, so it must not follow a renamed + # workflow or job. + GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency_submission-dependency-submission + steps: + - name: Check out code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Setup JDK 17 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: 'corretto' + java-version: '17' + + # GitHub cannot read Gradle dependencies from the build files, so Gradle resolves them into a list. + - name: Generate the dependency graph + uses: gradle/actions/dependency-submission@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 + with: + dependency-graph: generate-and-upload + # Only what the published library ships: its runtime classpath, without the test classpaths and the + # build tooling. Alerts for anything else would not be about the SDK. + dependency-graph-include-configurations: runtimeClasspath + # The list is only handed to the next job. + artifact-retention-days: 1 + # This job has its own cache entry, which nothing else would read. + cache-read-only: true + + dependency-submission: + name: Dependency Submission + needs: gradle-dependencies + # Pull requests from forks and from Dependabot get a read-only token, which cannot submit. + if: >- + github.event_name != 'pull_request' || + (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') + # The submission goes through the GitHub API, so the job needs the paid runner group. + runs-on: + group: github-public-amd64 + timeout-minutes: 5 + permissions: + contents: write + steps: + - name: Submit the dependency graph + uses: gradle/actions/dependency-submission@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 + with: + dependency-graph: download-and-submit + cache-disabled: true + dependency-review: name: Dependency Review + # After the submission, never next to it: GitHub caches what it answers to the review's request, so a review + # that asks before the Gradle dependencies are in keeps getting the answer without them. + needs: dependency-submission + # Still runs when the submission was skipped (forks, Dependabot) or failed: everything but Gradle is reviewed. + if: ${{ !cancelled() && github.event_name == 'pull_request' }} runs-on: group: github-public-amd64 timeout-minutes: 5 diff --git a/.github/workflows/dependency_submission.yml b/.github/workflows/dependency_submission.yml deleted file mode 100644 index 98927444..00000000 --- a/.github/workflows/dependency_submission.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Dependency Submission - -on: - push: - branches: [main] - pull_request: - paths: - - .github/workflows/dependency_submission.yml - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - dependency-submission: - name: Dependency Submission - # A pull request from a fork gets a read-only token, which cannot submit. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - # The submission goes through the GitHub API, so the job needs the paid runner group. - runs-on: - group: github-public-amd64 - timeout-minutes: 15 - permissions: - contents: write - steps: - - name: Check out code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - - name: Setup JDK 17 - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 - with: - distribution: 'corretto' - java-version: '17' - - # GitHub cannot read Gradle dependencies from the build files, so Gradle resolves them and submits the list. - - name: Generate and submit the dependency graph - uses: gradle/actions/dependency-submission@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 - with: - dependency-graph: generate-and-submit - # Only what the published library ships: its runtime classpath, without the test classpaths and the - # build tooling. Alerts for anything else would not be about the SDK. - dependency-graph-include-configurations: runtimeClasspath - # This job has its own cache entry, which nothing else would read. - cache-read-only: true