-
Notifications
You must be signed in to change notification settings - Fork 27.4k
78 lines (74 loc) · 3.18 KB
/
self-comment-slow-ci.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: PR comment github action tests
on:
issue_comment:
types:
- created
- labeled
branches-ignore:
- main
pull_request_review_comment:
types: [created, deleted]
pull_request:
concurrency:
# But this will cancel the current job no ? Because they have the same PR number ... (any comment even not the target one)
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: ${{ github.event.issue.pull_request != null || github.event.pull_request != null }}
jobs:
reply-and-trigger:
# if: contains(github.event.comment.body,'/pytest')
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Trigger specific job
run: |
echo "${{ github.head_ref }}"
echo "${{ github.ref }}"
echo "${{ github.sha }}"
echo "${{ github.event.pull_request.number }}"
echo "${{ github.event.issue.number }}"
echo "${{ github.event.issue.pull_request }}"
echo "${{ github.event.pull_request }}"
echo "${{ github.event.issue.pull_request != null }}"
echo "${{ github.event.pull_request != null }}"
ecjp "${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }}"
# - name: Set up GitHub CLI
# uses: actions/checkout@v4
#
# - name: Reply to the comment
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
# -f "body=This comment contains /pytest, running the specified job..."
#
# - name: Create Run
# id: create_run
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
# -f "target_url=$GITHUB_RUN_URL" -f "state=pending" -f "description=Custom CI job" -f "context=pytest/custom-tests"
# - name: Trigger specific job
# run: |
# echo "Running the specific job because /pytest was found"
# # Add the logic to trigger your specific job here
# - name: Update Check Run Status
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
# run: |
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
# -f "target_url=$GITHUB_RUN_URL" -f "state=success" -f "description=Custom CI job" -f "context=pytest/custom-tests"