diff --git a/docs/examples.md b/docs/examples.md index 5e326f4..6e5732e 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -5,6 +5,7 @@ - [Keep a branch up-to-date with another](#keep-a-branch-up-to-date-with-another) - [Use case: Create a pull request to update X periodically](#use-case-create-a-pull-request-to-update-x-periodically) - [Update NPM dependencies](#update-npm-dependencies) + - [Update Gradle dependencies](#update-gradle-dependencies) - [Update SwaggerUI for GitHub Pages](#update-swaggerui-for-github-pages) - [Spider and download a website](#spider-and-download-a-website) - [Use case: Create a pull request to update X by calling the GitHub API](#use-case-create-a-pull-request-to-update-x-by-calling-the-github-api) @@ -144,6 +145,44 @@ jobs: - run: npm run build ``` +### Update Gradle dependencies + +The following workflow will create a pull request for Gradle dependencies. +It requires first configuring your project to use Gradle lockfiles. +See [here](https://github.com/peter-evans/gradle-auto-dependency-updates) for how to configure your project and use the following workflow. + +```yml +name: Update Dependencies +on: + schedule: + - cron: '0 1 * * 1' +jobs: + update-dep: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Perform dependency resolution and write new lockfiles + run: ./gradlew dependencies --write-locks + - name: Create Pull Request + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.PAT }} + commit-message: Update dependencies + title: Update dependencies + body: | + - Dependency updates + + Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request + branch: update-dependencies +``` + ### Update SwaggerUI for GitHub Pages When using [GitHub Pages to host Swagger documentation](https://github.com/peter-evans/swagger-github-pages), this workflow updates the repository with the latest distribution of [SwaggerUI](https://github.com/swagger-api/swagger-ui).