@@ -15,39 +15,22 @@ name: Librarian generate diff check on pull requests
1515on :
1616 pull_request :
1717
18- env :
19- REPO_FULL_NAME : ${{ github.event.pull_request.head.repo.full_name }}
20- GITHUB_REPOSITORY : ${{ github.repository }}
21-
2218jobs :
2319 library_generation :
2420 runs-on : ubuntu-24.04
2521 steps :
26- - name : Determine whether the pull request comes from a fork
27- run : |
28- if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
29- echo "This PR comes from a fork. Skip library generation."
30- echo "SHOULD_RUN=false" >> $GITHUB_ENV
31- else
32- echo "SHOULD_RUN=true" >> $GITHUB_ENV
33- fi
3422 - uses : actions/checkout@v4
35- if : env.SHOULD_RUN == 'true'
3623 with :
3724 fetch-depth : 0
38- token : ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
3925 - uses : actions/setup-go@v5
40- if : env.SHOULD_RUN == 'true'
4126 with :
4227 go-version : ' stable'
4328 - name : Install Librarian
44- if : env.SHOULD_RUN == 'true'
4529 run : |
4630 V=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
4731 echo "Installing librarian version $V"
4832 go install github.com/googleapis/librarian/cmd/librarian@$V
4933 - name : Install protoc
50- if : env.SHOULD_RUN == 'true'
5134 run : |
5235 set -e
5336 VERSION="33.2"
@@ -56,36 +39,30 @@ jobs:
5639 sudo unzip -o /tmp/protoc.zip
5740 protoc --version
5841 - uses : actions/setup-java@v4
59- if : env.SHOULD_RUN == 'true'
6042 with :
6143 java-version : " 17"
6244 distribution : " temurin"
6345 cache : " maven"
6446 - name : Verify Java and Maven installation
65- if : env.SHOULD_RUN == 'true'
6647 run : |
6748 java -version
6849 if ! command -v mvn &> /dev/null; then
6950 sudo apt-get update && sudo apt-get install -y maven
7051 fi
7152 mvn -version
7253 - uses : actions/setup-python@v5
73- if : env.SHOULD_RUN == 'true'
7454 with :
7555 python-version : " 3.12"
7656 cache : ' pip'
7757 - name : Run librarian install
78- if : env.SHOULD_RUN == 'true'
7958 run : |
8059 librarian install
8160 echo "$HOME/java_tools/bin" >> $GITHUB_PATH
8261 - name : Run librarian generate
83- if : env.SHOULD_RUN == 'true'
8462 env :
8563 PYTHONPATH : ${{ github.workspace }}/sdk-platform-java/hermetic_build/library_generation/owlbot
8664 run : |
8765 librarian generate --all
8866 - name : Check for generated code changes
89- if : env.SHOULD_RUN == 'true'
9067 run : |
9168 git diff --exit-code
0 commit comments