chore: Add DIREGAPIC Updater github action

PiperOrigin-RevId: 450721505
This commit is contained in:
Google APIs 2022-05-24 10:55:36 -07:00 committed by Copybara-Service
parent 6e77a717ef
commit 80c19a4eb7
2 changed files with 51 additions and 0 deletions

View file

@ -5,6 +5,7 @@
filters:
# Don't close PRs in the pubsub_dev branch.
- '@.pull_request.base.ref != "pubsub_dev"'
- '@.pull_request.base.ref != "diregapic"'
# The message to post to the closed PR.
commentBody: |

50
.github/workflows/diregapic.yaml vendored Normal file
View file

@ -0,0 +1,50 @@
---
name: DIREGAPIC Updater
on: # yamllint disable-line rule:truthy
schedule:
- cron: '19 */8 * * *'
workflow_dispatch:
jobs:
regenerate-compute:
runs-on: ubuntu-latest
container: gcr.io/gapic-images/googleapis:20220222
steps:
- name: Checkout master
uses: actions/checkout@v3
with:
ref: master
- name: Download discovery docs
run: |
curl https://www.googleapis.com/discovery/v1/apis/compute/v1/rest --output google/cloud/compute/v1/compute.v1.json
echo compute_revision=$(grep -oP '"revision":\s*"\d+"' google/cloud/compute/v1/compute.v1.json | grep -oP '\d+') >> $GITHUB_ENV
- name: Regenerate API definitions
run: |
bazel build //google/cloud/compute/v1:compute_gen
cp bazel-bin/google/cloud/compute/v1/compute_gen.proto google/cloud/compute/v1/compute.proto
bazel build //google/cloud/compute/v1:compute_grpc_service_config_gen
cp bazel-bin/google/cloud/compute/v1/compute_grpc_service_config_gen.json google/cloud/compute/v1/compute_grpc_service_config.json
bazel build //google/cloud/compute/v1:compute_gapic_gen
cp bazel-bin/google/cloud/compute/v1/compute_gapic_gen.yaml google/cloud/compute/v1/compute_gapic.yaml
echo api_changes=$(git diff-index --shortstat HEAD) >> $GITHUB_ENV
- name: Build GAPIC clients
if: contains(env.api_changes, 'file')
run: |
bazel build //google/cloud/compute/v1/...
bazel build //google/cloud/compute/v1/...
- name: Create PR
uses: googleapis/code-suggester@v2
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: googleapis
upstream_repo: googleapis
title: 'feat: [DIREGAPIC] Update API definitions'
description: 'feat: Update Compute Engine API to revision ${{ env.compute_revision }}'
message: 'feat: Update Compute Engine API to revision ${{ env.compute_revision }}'
primary: 'master'
branch: diregapic
git_dir: '.'
force: true
fork: true