-
Notifications
You must be signed in to change notification settings - Fork 50
86 lines (85 loc) · 2.75 KB
/
deps.yaml
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
---
name: Generator dependency management
on:
push:
paths:
- go.mod
- go.sum
- showcase/go.mod
- showcase/go.sum
workflow_dispatch: {} # Allow manual triggering
jobs:
update-bazel-deps:
if: github.ref == 'refs/heads/main'
outputs:
changed: ${{ steps.update.outputs.changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/[email protected]
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
- name: Run gazelle update-repos
id: update
run: |
bazelisk run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
sed -i "s/ \"go_repository\",//g" repositories.bzl
bazelisk run //:gazelle -- update-repos -from_file=showcase/go.mod -to_macro=repositories.bzl%com_googleapis_gapic_generator_go_repositories
sed -i "s/ \"go_repository\",//g" repositories.bzl
set +e
git diff --exit-code repositories.bzl
echo ::set-output name=changed::$?
set -e
- name: Prepare repositories.bzl payload
if: steps.update.outputs.changed
run: tar czf repos.tgz repositories.bzl
- uses: actions/upload-artifact@v4
if: steps.update.outputs.changed
with:
name: repositories
path: repos.tgz
repositories-pr:
needs: update-bazel-deps
runs-on: ubuntu-latest
if: needs.update-bazel-deps.outputs.changed
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/download-artifact@v4
with:
name: repositories
- name: Expand repositories archive
run: |
tar xvzf repos.tgz
rm repos.tgz
- uses: googleapis/code-suggester@v4
id: code_suggester
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: googleapis
upstream_repo: gapic-generator-go
description: 'Updated Go dependencies for Bazel repositories.'
title: 'chore(bazel): update Bazel Go deps'
message: 'chore(bazel): update Bazel Go deps'
primary: 'main'
branch: update-bazel-deps
git_dir: '.'
force: true
- name: Add automerge label to pull request
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: ${{ steps.code_suggester.outputs.pull }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['automerge']
})