Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
secrets: inherit
# The size of the batch is implicitly decided by the hour of the day.
# For example, a job starting at "1:30" uses the chunk at the index 1 in the array.
if: github.event_name != 'workflow_dispatch' && ${{!!fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour]}}
if: ${{ github.event_name != 'workflow_dispatch' && !!fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour] }}
with:
services: ${{toJson(fromJson(needs.batch.outputs.services).batches[fromJson(needs.batch.outputs.services).hour])}}
generate_dispatch:
Expand Down
54 changes: 40 additions & 14 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
with:
fetch-depth: 1
path: google-api-java-client-services
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
- uses: actions/checkout@v2
with:
repository: googleapis/discovery-artifact-manager
Expand All @@ -41,18 +42,43 @@ jobs:
pip install pip==21.3.1
pip --version
- run: ./google-api-java-client-services/.github/workflows/generate.sh ${{ matrix.service }}
- uses: googleapis/code-suggester@v2 # takes the changes from git directory
- name: Create PR via Local Checkout (Large Commit Support)
shell: bash
working-directory: google-api-java-client-services
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: ${{ github.repository_owner }}
upstream_repo: google-api-java-client-services
description: 'Generated in GitHub action: https://github.com/${{ github.repository_owner }}/${{ github.repository }}/actions/workflows/codegen.yaml'
title: 'chore: regenerate ${{ matrix.service }} client'
message: 'chore: regenerate ${{ matrix.service }} client'
branch: regenerate-${{ matrix.service }}
git_dir: 'google-api-java-client-services/clients/google-api-services-${{ matrix.service }}'
primary: main
force: true
fork: true
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
SERVICE: ${{ matrix.service }}
AUTHOR: "Cloud Java Bot <cloud-java-bot@google.com>"
BASE_REPO: "${{ github.repository }}"
run: |
set -ex

# 1. Setup Identity
git config user.name "Cloud Java Bot"
git config user.email "cloud-java-bot@google.com"

# 3. Create Branch
BRANCH="regenerate-${SERVICE}"
git checkout -b "$BRANCH"

# 4. Stage specific files (Large commit handling)
TARGET_PATH="clients/google-api-services-${SERVICE}"
git add "$TARGET_PATH"

# 5. Commit & Push
MESSAGE="chore: regenerate ${SERVICE} client"
if git diff-index --quiet HEAD --; then
echo "No changes to commit for ${SERVICE}."
exit 0
fi

git commit -m "$MESSAGE"
git push origin "$BRANCH" --force

gh pr create \
--repo "$BASE_REPO" \
--head "${BRANCH}" \
--base "main" \
--title "$MESSAGE" \
--body "Generated in GitHub action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|| echo "PR already exists or failed to create, but changes are pushed."
Loading