diff --git a/.github/workflows/regenerate-all.yml b/.github/workflows/regenerate-all.yml index 1cc79a531cbc..3cc5e49bbb70 100644 --- a/.github/workflows/regenerate-all.yml +++ b/.github/workflows/regenerate-all.yml @@ -1,7 +1,7 @@ name: Regenerate all packages after merging to main on: - push: + pull_request: branches: - main @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-latest env: PANDOC_VERSION: 3.8.2 + CACHE_VERSION: v2 steps: - name: Checkout @@ -27,7 +28,7 @@ jobs: - name: Install protoc uses: arduino/setup-protoc@v3 with: - version: "25.3" + version: "33.2" - name: Install pandoc run: | @@ -39,13 +40,42 @@ jobs: - name: Install Python packages for Librarian run: | version=$(sed -n 's/^version: *//p' librarian.yaml) - go run "github.com/googleapis/librarian/cmd/librarian@${version}" install + go run "github.com/googleapis/librarian/cmd/librarian@v0.13.0" install + + - name: Debug Git State + run: | + echo "Current directory: $(pwd)" + echo "Git status:" + git status + echo "Git branch output:" + git branch + echo "HEAD reference:" + git rev-parse HEAD + echo "Current branch:" + git branch --show-current + echo "Is this a shallow clone?" + [ -f .git/shallow ] && echo "Yes, it is shallow" || echo "No, it is not shallow" + + - name: Force Git Environment + run: | + # The runner image likely updated and is now stricter about git state. + # We force a valid git state so that synthtool doesn't panic. + git config --global user.email "ci@example.com" + git config --global user.name "CI Bot" + git config --global init.defaultBranch main + # Ensure current directory is a safe directory for git + git config --global --add safe.directory /home/runner/work/google-cloud-python/google-cloud-python + # Ensure a local branch exists + git checkout -B main - name: Regenerate run: | + # 1. Clean the cache that synthtool uses + rm -rf $HOME/.cache/synthtool + version=$(sed -n 's/^version: *//p' librarian.yaml) PATH=$PATH:/tmp/pandoc/bin - go run "github.com/googleapis/librarian/cmd/librarian@${version}" generate -all -v + go run "github.com/googleapis/librarian/cmd/librarian@v0.13.0" generate -all -v - name: Create issue on diff env: