-
-
Notifications
You must be signed in to change notification settings - Fork 39
build(plugin): Add dependency locking and verification to plugin-build (GRADLE-104)
#1256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e14406d
574cc51
644a45b
36a6a8c
630801b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Update Dependency Locks | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is generated by claude and not tested. We'll just need to merge this and adjust as needed since there isn't really a way to testing the full integration and secrets. |
||
|
|
||
| # Dependabot bumps versions in gradle/libs.versions.toml but cannot regenerate | ||
| # the plugin-build lockfile or verification metadata (it has no support for the | ||
| # latter, and its lockfile support breaks with version catalogs). Without this, | ||
| # every Dependabot Gradle PR fails STRICT-mode locking and checksum verification. | ||
| # This job regenerates both and pushes them back onto the Dependabot branch. | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| # The job pushes via CI_DEPLOY_KEY (SSH), so the GITHUB_TOKEN needs no write | ||
| # scopes. dependabot/fetch-metadata reads PR metadata via the API, which | ||
| # requires pull-requests: read. | ||
| permissions: | ||
| contents: read | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| regenerate: | ||
| name: Regenerate lockfile and verification metadata | ||
| # Dependabot-triggered runs read secrets from the Dependabot secret store, so | ||
| # CI_DEPLOY_KEY must be added there (Settings -> Secrets -> Dependabot), not | ||
| # only to Actions secrets. | ||
| if: github.actor == 'dependabot[bot]' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Fetch Dependabot metadata | ||
| id: metadata | ||
| uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 | ||
|
|
||
| - name: Check out PR branch | ||
| if: steps.metadata.outputs.package-ecosystem == 'gradle' | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| # Pushing with the deploy key (rather than GITHUB_TOKEN) re-triggers CI | ||
| # so the regenerated files are validated. | ||
| ssh-key: ${{ secrets.CI_DEPLOY_KEY }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to add this secret. |
||
|
|
||
| - name: Setup Gradle | ||
| if: steps.metadata.outputs.package-ecosystem == 'gradle' | ||
| uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # pin@v6 | ||
|
|
||
| - name: Set up Java | ||
| if: steps.metadata.outputs.package-ecosystem == 'gradle' | ||
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
|
|
||
| - name: Regenerate lockfile and verification metadata | ||
| if: steps.metadata.outputs.package-ecosystem == 'gradle' | ||
| run: ./gradlew -p plugin-build resolveAndLockAll --write-locks --write-verification-metadata sha256 | ||
|
|
||
| - name: Commit and push if changed | ||
| if: steps.metadata.outputs.package-ecosystem == 'gradle' | ||
| run: | | ||
| files="plugin-build/gradle.lockfile plugin-build/settings-gradle.lockfile plugin-build/gradle/verification-metadata.xml" | ||
| if git diff --quiet -- $files; then | ||
| echo "No lockfile or verification metadata changes." | ||
| exit 0 | ||
| fi | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add $files | ||
| git commit -m "build(plugin): Regenerate dependency locks and verification metadata" | ||
| git push | ||
Uh oh!
There was an error while loading. Please reload this page.