Fetch latest versions #1400
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Fetch latest versions | |
| # When triggering a manual execution of the workflow, you may want to disable the scheduled execution temporarily | |
| # to ensure that any in-flight generated PR is not overridden by the scheduled execution. | |
| on: | |
| schedule: | |
| # Run once a day at 10 AM EST | |
| - cron: "0 14 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| fetch-versions: | |
| if: github.repository == 'bufbuild/plugins' | |
| runs-on: ubuntu-latest-4-cores | |
| steps: | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 | |
| with: | |
| app-id: 249762 | |
| private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | |
| permission-contents: write | |
| permission-pull-requests: write | |
| - name: Checkout repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| check-latest: true | |
| - name: Get buf version | |
| shell: bash | |
| run: | | |
| echo BUF_VERSION=$(go list -m -f '{{.Version}}' github.com/bufbuild/buf | cut -c2-) >> $GITHUB_ENV | |
| - uses: bufbuild/buf-action@v1 | |
| with: | |
| setup_only: true | |
| - uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Fetch all versions | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| run: | | |
| go run ./internal/cmd/fetcher . | |
| - name: Archive plugin generated code | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: plugin-generated-code | |
| path: | | |
| tests/testdata/**/gen/** | |
| retention-days: 7 | |
| - name: Create PR | |
| uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9 | |
| with: | |
| add-paths: . | |
| commit-message: "detected new plugin versions" | |
| branch: fetch-versions | |
| delete-branch: true | |
| title: "Found new plugin versions" | |
| body: "New plugin versions found. Please review." | |
| assignees: mfridman, pkwarren, stefanvanburen | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - name: Generate Github Token | |
| id: generate_issues_token | |
| uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 | |
| if: ${{ failure() }} | |
| with: | |
| app-id: ${{ secrets.BUFBUILD_ISSUE_CREATOR_APP_ID }} | |
| private-key: ${{ secrets.BUFBUILD_ISSUE_CREATOR_APP_KEY }} | |
| permission-issues: write | |
| - uses: dblock/create-a-github-issue@c5e54b8762a0c4c2cd9330750e30b81bcc369c38 # v3.2.0 | |
| if: ${{ failure() }} | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_issues_token.outputs.token }} | |
| GITHUB_SERVER_URL: ${ github.server_url }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} | |
| with: | |
| filename: .github/automatic-workflow-issue-template.md | |
| update_existing: true | |
| search_existing: open |