-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add new_client workflow (#8446)
- Loading branch information
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
name: new_client | ||
on: | ||
push: | ||
# Per GitHub Action docs, specifying both branch and paths joins them with AND. | ||
branches: | ||
- main | ||
paths: | ||
- '**/version.go' | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
new_versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.x | ||
- name: Find new version files | ||
id: versions | ||
# Ignore changes to the internal and root directories. | ||
# Focus on newly added version.go files generated by GAPIC. | ||
# Multiple new version files in a single module file will be deduped. | ||
run: | | ||
dirs=$(go run ./internal/actions/cmd/changefinder -q --diff-filter=A --path-filter='*version.go' --content-regex='internal\.Version') | ||
if [ -z "$dirs" ] | ||
then | ||
echo "skip=1" >> $GITHUB_OUTPUT | ||
echo "No new version files!" | ||
else | ||
for d in $dirs; do list=${list},\"${d}\"; done | ||
echo "new={\"new\":[${list#,}]}" >> $GITHUB_OUTPUT | ||
echo "skip=" >> $GITHUB_OUTPUT | ||
fi | ||
outputs: | ||
versions: ${{ steps.versions.outputs.new }} | ||
skip: ${{ steps.versions.outputs.skip }} | ||
bump_module: | ||
needs: new_versions | ||
runs-on: ubuntu-latest | ||
if: "!needs.new_versions.outputs.skip" | ||
continue-on-error: true | ||
strategy: | ||
matrix: ${{ fromJson(needs.new_versions.outputs.versions) }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: echo >> ${{ matrix.new }}/CHANGES.md | ||
- uses: googleapis/code-suggester@v4 | ||
id: code_suggester | ||
env: | ||
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} | ||
with: | ||
command: pr | ||
upstream_owner: googleapis | ||
upstream_repo: google-cloud-go | ||
description: 'New client(s) generated in ${{ github.commits[0][url] }}, triggering release.' | ||
title: 'feat(${{ matrix.new }}): new client(s)' | ||
message: 'feat(${{ matrix.new }}): new clients' | ||
primary: 'main' | ||
branch: release-${{ matrix.new }}-client | ||
git_dir: '.' | ||
force: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters