Skip to content

Commit 2e1329e

Browse files
authored
chore: use composite action (#3351)
1 parent 35a8eb2 commit 2e1329e

File tree

2 files changed

+15
-133
lines changed

2 files changed

+15
-133
lines changed

.github/scripts/hermetic_library_generation.sh

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/hermetic_library_generation.yaml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,28 @@ on:
1818
pull_request:
1919

2020
env:
21-
HEAD_REF: ${{ github.head_ref }}
2221
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
2322
GITHUB_REPOSITORY: ${{ github.repository }}
24-
2523
jobs:
2624
library_generation:
2725
runs-on: ubuntu-latest
2826
steps:
27+
- name: Determine whether the pull request comes from a fork
28+
run: |
29+
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
30+
echo "This PR comes from a fork. Skip library generation."
31+
echo "SHOULD_RUN=false" >> $GITHUB_ENV
32+
else
33+
echo "SHOULD_RUN=true" >> $GITHUB_ENV
34+
fi
2935
- uses: actions/checkout@v4
36+
if: env.SHOULD_RUN == 'true'
3037
with:
3138
fetch-depth: 0
3239
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
33-
- name: Generate changed libraries
34-
shell: bash
35-
run: |
36-
set -ex
37-
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
38-
echo "This PR comes from a fork. Generation will be skipped"
39-
exit 0
40-
fi
41-
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
42-
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
43-
bash .github/scripts/hermetic_library_generation.sh \
44-
--target_branch ${{ github.base_ref }} \
45-
--current_branch $HEAD_REF
46-
env:
47-
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40+
- uses: googleapis/sdk-platform-java/.github/[email protected]
41+
if: env.SHOULD_RUN == 'true'
42+
with:
43+
base_ref: ${{ github.base_ref }}
44+
head_ref: ${{ github.head_ref }}
45+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

0 commit comments

Comments
 (0)