Skip to content

Commit 976fe1d

Browse files
committed
update to use librarian config get
1 parent ba6f376 commit 976fe1d

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

.github/workflows/update_librarian_googleapis.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ jobs:
6060
run: |
6161
version=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
6262
go run "github.com/googleapis/librarian/cmd/librarian@${version}" update sources.googleapis
63+
- name: Get latest commit
64+
id: commit
65+
run: |
66+
version=$(go run github.com/googleapis/librarian/cmd/librarian@latest config get version)
67+
new_commit=$(go run "github.com/googleapis/librarian/cmd/librarian@${version}" config get sources.googleapis.commit)
68+
echo "new_commit=${new_commit}" >> $GITHUB_OUTPUT
69+
echo "short_commit=${new_commit:0:7}" >> $GITHUB_OUTPUT
6370
- name: Detect Changes
6471
id: detect
6572
run: |
@@ -70,25 +77,13 @@ jobs:
7077
echo "No changes in librarian.yaml"
7178
else
7279
echo "has_changes=true" >> $GITHUB_OUTPUT
73-
74-
# Get the new commit hash
75-
new_commit=$(git diff --cached librarian.yaml | grep -E '^\+ commit:' | head -n 1 | awk '{print $3}')
76-
echo "new_commit=${new_commit}" >> $GITHUB_OUTPUT
77-
78-
if [ -n "${new_commit}" ]; then
79-
echo "title=chore: update googleapis commitish to ${new_commit:0:7}" >> $GITHUB_OUTPUT
80-
echo "body=Updated googleapis commitish in librarian.yaml to https://github.com/googleapis/googleapis/commit/${new_commit}" >> $GITHUB_OUTPUT
81-
else
82-
echo "title=chore: update googleapis commitish in librarian.yaml" >> $GITHUB_OUTPUT
83-
echo "body=Updated googleapis commitish in librarian.yaml to the latest version." >> $GITHUB_OUTPUT
84-
fi
8580
fi
8681
- name: Commit and Create PR
8782
if: steps.detect.outputs.has_changes == 'true'
8883
env:
8984
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
90-
PR_TITLE: ${{ steps.detect.outputs.title }}
91-
PR_BODY: ${{ steps.detect.outputs.body }}
85+
PR_TITLE: "chore: update googleapis commitish to ${{ steps.commit.outputs.short_commit }}"
86+
PR_BODY: "Updated googleapis commitish in librarian.yaml to https://github.com/googleapis/googleapis/commit/${{ steps.commit.outputs.new_commit }}"
9287
run: |
9388
set -x
9489

0 commit comments

Comments
 (0)