...
1---
2name: new_client
3on:
4 push:
5 # Per GitHub Action docs, specifying both branch and paths joins them with AND.
6 branches:
7 - main
8 paths:
9 - '**/version.go'
10
11permissions:
12 contents: read
13
14jobs:
15 new_versions:
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@v4
19 with:
20 fetch-depth: 2
21 - uses: actions/setup-go@v5
22 with:
23 go-version: 1.22.x
24 - name: Find new version files
25 id: versions
26 # Ignore changes to the internal and root directories.
27 # Focus on newly added version.go files generated by GAPIC.
28 # Multiple new version files in a single module file will be deduped.
29 run: |
30 dirs=$(go run ./internal/actions/cmd/changefinder -q --base=HEAD~1 --diff-filter=A --path-filter='*version.go' --content-regex='internal\.Version')
31 if [ -z "$dirs" ]
32 then
33 echo "skip=1" >> $GITHUB_OUTPUT
34 echo "No new version files!"
35 else
36 for d in $dirs; do list=${list},\"${d}\"; done
37 echo "new={\"new\":[${list#,}]}" >> $GITHUB_OUTPUT
38 echo "skip=" >> $GITHUB_OUTPUT
39 fi
40 outputs:
41 versions: ${{ steps.versions.outputs.new }}
42 skip: ${{ steps.versions.outputs.skip }}
43 bump_module:
44 needs: new_versions
45 runs-on: ubuntu-latest
46 if: "!needs.new_versions.outputs.skip"
47 continue-on-error: true
48 strategy:
49 matrix: ${{ fromJson(needs.new_versions.outputs.versions) }}
50 steps:
51 - uses: actions/checkout@v4
52 - run: echo >> ${{ matrix.new }}/CHANGES.md
53 - uses: googleapis/code-suggester@v4
54 id: code_suggester
55 env:
56 ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
57 with:
58 command: pr
59 upstream_owner: googleapis
60 upstream_repo: google-cloud-go
61 description: 'New client(s) generated in ${{ github.event.commits[0].url }}, triggering release.'
62 title: 'feat(${{ matrix.new }}): new client(s)'
63 message: 'feat(${{ matrix.new }}): new clients'
64 primary: 'main'
65 branch: release-${{ matrix.new }}-client
66 git_dir: '.'
67 force: true
View as plain text