Skip to content
Open
Changes from 5 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
49 changes: 46 additions & 3 deletions .github/workflows/update_librarian_googleapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ jobs:
new_commit=$(go run "github.com/googleapis/librarian/cmd/librarian@${version}" config get sources.googleapis.commit)
echo "new_commit=${new_commit}" >> $GITHUB_OUTPUT
echo "short_commit=${new_commit:0:7}" >> $GITHUB_OUTPUT
- name: Detect Changes
id: detect
- name: Detect Changes To Librarian.yaml
id: detect_librarian
run: |
git add librarian.yaml
changed_files=$(git diff --cached --name-only)
Expand All @@ -79,8 +79,51 @@ jobs:
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Install protoc
run: |
set -e
VERSION="33.2"
curl -fsSL --retry 5 --retry-delay 15 -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip"
cd /usr/local
sudo unzip -o /tmp/protoc.zip
protoc --version
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Verify Java and Maven installation
run: |
java -version
if ! command -v mvn &> /dev/null; then
sudo apt-get update && sudo apt-get install -y maven
fi
mvn -version
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Run librarian install
run: |
go run github.com/googleapis/librarian/cmd/librarian@latest install
echo "$HOME/java_tools/bin" >> $GITHUB_PATH
env:
PYTHONPATH: ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot
- name: Generate Libraries
if: steps.detect_librarian.outputs.has_changes == 'true'
id: generate
run: |
go run github.com/googleapis/librarian/cmd/librarian@latest generate --all
git add .
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" == "" ]]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No changes in libraries"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and Create PR
if: steps.detect.outputs.has_changes == 'true'
if: steps.detect_librarian.outputs.has_changes == 'true' || steps.generate.outputs.has_changes == 'true'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create 2 separate commits, one for config change, and one for generated code change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm not sure I follow, the config change one existed previously - I'm just renaming it so it's less confusing. Do you want me to revert the name to detect?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PR that this workflow creates, the code change contains 1) change to librarian.yaml 2) change to generated code. Let's create separate commit for these in the PR.
This can be a follow up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, in the actual workflow itself (I thought you meant in the PR). Got it, I can create a F/U bug for it.

env:
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
PR_TITLE: "chore: update googleapis commitish to ${{ steps.commit.outputs.short_commit }}"
Expand Down
Loading