1
+ # Copyright 2024 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ name : Vertex AI Mock Responses Check
16
+
17
+ on : pull_request
18
+
19
+ jobs :
20
+ check :
21
+ runs-on : ubuntu-latest
22
+ steps :
23
+ - uses : actions/checkout@v4
24
+ - name : Clone mock responses
25
+ run : scripts/update_vertexai_responses.sh
26
+ - name : Find cloned and latest versions
27
+ run : |
28
+ echo "current_tag=$(git tag)" >> $GITHUB_ENV
29
+ # Fetch the latest tag matching the major version from the golden files repository
30
+ echo "latest_tag=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/FirebaseExtended/vertexai-sdk-test-data.git | tail -n1 | awk -F'/' '{print $NF}')" >> $GITHUB_ENV
31
+ working-directory : packages/vertexai/test-utils/vertexai-sdk-test-data
32
+ - name : Find comment from previous run if exists
33
+ uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
34
+ id : fc
35
+ with :
36
+ issue-number : ${{github.event.number}}
37
+ body-includes : Vertex AI Mock Responses Check
38
+ - name : Comment on PR if newer version is available
39
+ if : ${{env.current_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
40
+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
41
+ with :
42
+ issue-number : ${{github.event.number}}
43
+ body : |
44
+ ### Vertex AI Mock Responses Check :warning:
45
+ A newer major version of the mock responses for Vertex AI unit tests is available.
46
+ [update_vertexai_responses.sh](https://github.com/firebase/firebase-js-sdk/blob/main/scripts/update_vertexai_responses.sh) \
47
+ should be updated to clone the latest version of the responses.
48
+ - name : Delete comment when version gets updated
49
+ if : ${{env.current_tag == env.latest_tag && steps.fc.outputs.comment-id}}
50
+ uses : detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0
51
+ with :
52
+ comment-id : ${{ steps.fc.outputs.comment-id }}
0 commit comments