Skip to content

Commit d485343

Browse files
authored
chore(ci): use new librarian action (#17316)
Switches librarian related CI to use the new librarian action for install/setup. Also switches `librarian_tidy` action to use path filters rather than `pull_request` filters so that we could feasibly make it a required check on presubmit that doesn't block when its not supposed to run.
1 parent 86e57cb commit d485343

2 files changed

Lines changed: 17 additions & 23 deletions

File tree

.github/workflows/librarian_tidy.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: librarian tidy
22

33
on:
44
pull_request:
5-
paths:
6-
- 'librarian.yaml'
75

86
permissions:
97
contents: read
@@ -14,19 +12,21 @@ jobs:
1412
steps:
1513
- name: Checkout
1614
uses: actions/checkout@v6
17-
18-
- name: Install Go
19-
uses: actions/setup-go@v6
15+
- uses: dorny/paths-filter@v4
16+
id: changes
2017
with:
21-
go-version: '1.26.x'
18+
filters: |
19+
librarian:
20+
- 'librarian.yaml'
21+
22+
- uses: googleapis/librarian@main
2223

2324
- name: Run librarian tidy
24-
run: |
25-
V=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
26-
go run github.com/googleapis/librarian/cmd/librarian@${V} tidy
27-
git diff
25+
if: steps.changes.outputs.librarian == 'true'
26+
run: librarian tidy
2827

2928
- name: Check for diff
29+
if: steps.changes.outputs.librarian == 'true'
3030
run: |
3131
if ! git diff --exit-code; then
3232
V=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)

.github/workflows/regenerate-all.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,10 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v6
2222

23-
- name: Install Go
24-
uses: actions/setup-go@v6
23+
- uses: googleapis/librarian@main
2524
with:
26-
go-version: '1.26.x'
27-
28-
- name: Install protoc
29-
uses: arduino/setup-protoc@v3
30-
with:
31-
version: "25.3"
25+
protoc-version: "25.3"
26+
protoc-checksum: "5ec3474ca09df0511bb2ca66b5ca091fa8943c30aa26285f225d0b1ba60b5665b3419be4cd2322decbb55464039ca0a0405a47e86bcc11491589405d615d280e"
3227

3328
- name: Install pandoc
3429
run: |
@@ -38,21 +33,20 @@ jobs:
3833
tar -xvf /tmp/pandoc.tar.gz -C /tmp/pandoc --strip-components=1
3934
4035
- name: Install Python packages for Librarian
41-
run: |
42-
version=$(sed -n 's/^version: *//p' librarian.yaml)
43-
go run "github.com/googleapis/librarian/cmd/librarian@${version}" install
36+
run: librarian install
4437

4538
- name: Clone Synthtool Templates
4639
run: |
4740
git clone --recurse-submodules --single-branch https://github.com/googleapis/synthtool.git /home/runner/synthtool
4841
4942
- name: Regenerate
5043
run: |
51-
version=$(sed -n 's/^version: *//p' librarian.yaml)
5244
PATH=$PATH:/tmp/pandoc/bin
53-
go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -all -v
45+
librarian generate -all -v
46+
git diff --exit-code
5447
5548
- name: Create issue on diff
49+
if: failure()
5650
env:
5751
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5852
run: |

0 commit comments

Comments
 (0)