-
Notifications
You must be signed in to change notification settings - Fork 46
41 lines (36 loc) · 1.15 KB
/
ci-build.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
name: ci-build
on:
workflow_dispatch:
issue_comment:
types: [created]
jobs:
run:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
ISSUE_BODY: "${{ github.event.issue.body }}"
steps:
- name: Parse comment
if: github.event.issue.pull_request
uses: khan/[email protected]
id: check
with:
trigger: '[ci-build]'
reaction: rocket
- name: Trigger PR workflows
if: steps.check.outputs.triggered == 'true'
run: |
echo "-----------"
body="$(echo "$ISSUE_BODY" | sed ':a;N;$!ba;s:\r:\\r:g;s:\n:\\n:g;')"
echo "body = $body"
suffix='\n[]()'
if echo "$body" | grep -q '\\n\[\]()$'; then
body="$(echo "$body" | sed 's:\\n\[\]()$::g;')"
suffix=''
fi
echo "-----------"
curl \
-H "Authorization: token ${{ secrets.SOFA_REPO_WRITE_TOKEN }}" \
-X PATCH \
-d "{\"body\":\"$body$suffix\"}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}