Skip to content

Fetch latest versions #522

Fetch latest versions

Fetch latest versions #522

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@v4
with:
go-version: '1.21'
check-latest: true
- name: Install buf cli
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
- 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@v3
with:
name: plugin-generated-code
path: |
tests/testdata/**/gen/**
retention-days: 7
- name: Create PR
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
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@866beb009af3db457e82ca98efe474969a5ebce8
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