Skip to content

Commit

Permalink
add PR comment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tanzimfh committed Jun 30, 2024
1 parent 55313a6 commit a6871e4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/vertexai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@ concurrency:
cancel-in-progress: true

jobs:
check-mock-responses-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone mock responses
run: scripts/update_vertexai_responses.sh
- name: Find cloned and latest versions
run: |
echo "current_tag=$(cd "$(dirname "$0")/../FirebaseVertexAI/Tests/Unit/vertexai-sdk-test-data" && git describe --tags | awk -F'/' '{print $NF}')" >> $GITHUB_ENV
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
- name: Find comment from previous run if exists
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{github.event.number}}
body-includes: Mock Responses Check
- name: Comment on PR if newer version is available
if: ${{env.current_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{github.event.number}}
body: |
### Vertex AI Mock Responses Check :warning:
A newer major version of the mock responses for Vertex AI unit tests is available.
[update_vertexai_responses.sh](https://github.com/firebase/firebase-ios-sdk/blob/main/scripts/update_vertexai_responses.sh) should be updated to clone the latest version of the responses.
- name: Fail job if newer version is available
if: ${{env.current_tag != env.latest_tag}}
run: exit 1
- name: Delete comment when version gets updated
if: ${{env.current_tag == env.latest_tag && steps.fc.outputs.comment-id}}
uses: detomarco/[email protected]
with:
comment-id: ${{ steps.fc.outputs.comment-id }}

spm-unit:
strategy:
matrix:
Expand Down

0 comments on commit a6871e4

Please sign in to comment.