|
| 1 | +name: Check Vertex AI Responses |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +jobs: |
| 6 | + check-version: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v4 |
| 10 | + - name: Clone mock responses |
| 11 | + run: firebase-vertexai/update_responses.sh |
| 12 | + - name: Find cloned and latest versions |
| 13 | + run: | |
| 14 | + CLONED=$(git describe --tags) |
| 15 | + LATEST=$(git tag --sort=v:refname | tail -n1) |
| 16 | + echo "cloned_tag=$CLONED" >> $GITHUB_ENV |
| 17 | + echo "latest_tag=$LATEST" >> $GITHUB_ENV |
| 18 | + working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data |
| 19 | + - name: Find comment from previous run if exists |
| 20 | + uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e |
| 21 | + id: fc |
| 22 | + with: |
| 23 | + issue-number: ${{github.event.number}} |
| 24 | + body-includes: Vertex AI Mock Responses Check |
| 25 | + - name: Comment on PR if newer version is available |
| 26 | + if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}} |
| 27 | + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 |
| 28 | + with: |
| 29 | + issue-number: ${{github.event.number}} |
| 30 | + body: > |
| 31 | + ### Vertex AI Mock Responses Check :warning: |
| 32 | + |
| 33 | + A newer major version of the mock responses for Vertex AI unit tests is available. |
| 34 | + [update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh) |
| 35 | + should be updated to clone the latest version of the responses: `${{env.latest_tag}}` |
| 36 | + - name: Delete comment when version gets updated |
| 37 | + if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}} |
| 38 | + uses: detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0 |
| 39 | + with: |
| 40 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
0 commit comments