Skip to content

Commit 6a82634

Browse files
authored
Use versions instead of commits in vertexai responses actions scripts (#8702)
1 parent 0755a72 commit 6a82634

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

.github/workflows/check-vertexai-responses.yml

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,44 @@ on: pull_request
1919
jobs:
2020
check-version:
2121
runs-on: ubuntu-latest
22+
# Allow GITHUB_TOKEN to have write permissions
23+
permissions:
24+
contents: write
2225
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-
CLONED=$(git describe --tags)
29-
LATEST=$(git tag --sort=v:refname | tail -n1)
30-
echo "cloned_tag=$CLONED" >> $GITHUB_ENV
31-
echo "latest_tag=$LATEST" >> $GITHUB_ENV
32-
working-directory: packages/vertexai/test-utils/vertexai-sdk-test-data
33-
- name: Find comment from previous run if exists
34-
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
35-
id: fc
36-
with:
37-
issue-number: ${{github.event.number}}
38-
body-includes: Vertex AI Mock Responses Check
39-
- name: Comment on PR if newer version is available
40-
if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
41-
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
42-
with:
43-
issue-number: ${{github.event.number}}
44-
body: >
45-
### Vertex AI Mock Responses Check :warning:
46-
47-
A newer major version of the mock responses for Vertex AI unit tests is available.
48-
[update_vertexai_responses.sh](https://github.com/firebase/firebase-js-sdk/blob/main/scripts/update_vertexai_responses.sh)
49-
should be updated to clone the latest version of the responses: `${{env.latest_tag}}`
50-
- name: Delete comment when version gets updated
51-
if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}}
52-
uses: detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0
53-
with:
54-
comment-id: ${{ steps.fc.outputs.comment-id }}
26+
- uses: actions/checkout@v4
27+
- name: Clone mock responses
28+
run: scripts/update_vertexai_responses.sh
29+
- name: Find cloned and latest versions
30+
run: |
31+
CLONED=$(git describe --tags)
32+
LATEST=$(git tag --sort=v:refname | tail -n1)
33+
echo "cloned_tag=$CLONED" >> $GITHUB_ENV
34+
echo "latest_tag=$LATEST" >> $GITHUB_ENV
35+
working-directory: packages/vertexai/test-utils/vertexai-sdk-test-data
36+
- name: Find comment from previous run if exists
37+
uses: peter-evans/find-comment@v3
38+
id: fc
39+
with:
40+
issue-number: ${{github.event.number}}
41+
body-includes: Vertex AI Mock Responses Check
42+
- name: Comment on PR if newer version is available
43+
if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
44+
uses: peter-evans/create-or-update-comment@v4
45+
with:
46+
issue-number: ${{github.event.number}}
47+
body: >
48+
### Vertex AI Mock Responses Check :warning:
49+
50+
A newer major version of the mock responses for Vertex AI unit tests is available.
51+
[update_vertexai_responses.sh](https://github.com/firebase/firebase-js-sdk/blob/main/scripts/update_vertexai_responses.sh)
52+
should be updated to clone the latest version of the responses: `${{env.latest_tag}}`
53+
- name: Delete comment when version gets updated
54+
if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}}
55+
uses: actions/github-script@v6
56+
with:
57+
script: |
58+
github.rest.issues.deleteComment({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
comment_id: ${{ steps.fc.outputs.comment-id }},
62+
})

0 commit comments

Comments
 (0)