-
Notifications
You must be signed in to change notification settings - Fork 24
99 lines (97 loc) · 4 KB
/
Copy pathfetch_versions.yml
File metadata and controls
99 lines (97 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Fetch latest versions
on:
schedule:
# Run once a day at 10 AM EST
- cron: "0 14 * * *"
workflow_dispatch:
permissions:
contents: read
issues: write
# Only allow a single fetch-versions workflow to run at a time so a manual run
# and the scheduled run don't race on the fetch-versions PR branch.
concurrency: ${{ github.workflow }}
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@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.TOKEN_EXCHANGE_GH_APP_CLIENT_ID }}
private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Checkout repository code
uses: actions/checkout@v7
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0 # full history needed for update_frequency git log lookups
- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
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@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Login to Docker Hub
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Fetch all versions
id: fetch_versions
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
go run ./internal/cmd/fetcher .
- name: Archive plugin generated code
uses: actions/upload-artifact@v7
with:
name: plugin-generated-code
path: |
tests/testdata/**/gen/**
retention-days: 7
- name: Create PR
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
add-paths: .
commit-message: "detected new plugin versions"
branch: fetch-versions
delete-branch: true
title: ${{ steps.fetch_versions.outputs.pr_title }}
body: ${{ steps.fetch_versions.outputs.pr_body }}
assignees: mfridman, oliversun9, pkwarren
token: ${{ steps.generate_token.outputs.token }}
author: ${{ steps.generate_token.outputs.app-slug }}[bot] <${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com>
committer: ${{ steps.generate_token.outputs.app-slug }}[bot] <${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com>
- name: Generate Github Token
id: generate_issues_token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.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@a25e69ccb88998dc267170a0dbde8ef8ac3a491c # v3.4.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