-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (44 loc) · 1.56 KB
/
auto-test-on-update.yml
File metadata and controls
48 lines (44 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Auto Test on Model Update PR
on:
pull_request_target:
types: [opened, reopened, synchronize]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
comment:
name: Comment /test-models
runs-on: ubuntu-latest
if: >-
(contains(github.event.pull_request.title, '[Community] Update model:') ||
contains(github.event.pull_request.title, 'update model YAMLs [bot]')) &&
github.event.pull_request.head.repo.full_name == github.repository
outputs:
comment_id: ${{ steps.post.outputs.comment_id }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: Post status comment
id: post
run: |
comment_id=$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
"/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
-f body='/test-models' \
--jq '.id')
echo "comment_id=$comment_id" >> "$GITHUB_OUTPUT"
echo "Posted status comment id=$comment_id"
test:
needs: comment
if: >-
(contains(github.event.pull_request.title, '[Community] Update model:') ||
contains(github.event.pull_request.title, 'update model YAMLs [bot]')) &&
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/test-changed-models-impl.yml
with:
pr_number: ${{ github.event.pull_request.number }}
comment_id: ${{ needs.comment.outputs.comment_id }}
secrets: inherit