Skip to content

Fetch latest versions #964

Fetch latest versions

Fetch latest versions #964

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: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
app_id: 249762
private_key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }}
permissions: >-
{"contents": "write", "pull_requests": "write"}
- name: Checkout repository code
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
check-latest: true
- name: Get buf version
shell: bash
run: |
echo BUF_VERSION=$(go list -m -json github.com/bufbuild/buf | jq -r .Version) >> $GITHUB_ENV
- name: Install buf cli
run: |
go install github.com/bufbuild/buf/cmd/buf@${BUF_VERSION}
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349
- 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@v4
with:
name: plugin-generated-code
path: |
tests/testdata/**/gen/**
retention-days: 7
- name: Create PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
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
token: ${{ steps.generate_token.outputs.token }}
- uses: dblock/create-a-github-issue@c5e54b8762a0c4c2cd9330750e30b81bcc369c38
if: failure()
env:
GITHUB_TOKEN: ${{ github.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