diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 00000000..8a6d2fcc --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,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/pull-request-comment-trigger@1.0.0 + 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 }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 3a30a7d2..eaaf914b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,6 +1,9 @@ name: MacOS CI -on: [workflow_dispatch, pull_request] +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: build: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6c84b8fd..b9f595ec 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,6 +1,9 @@ name: Ubuntu CI -on: [workflow_dispatch, pull_request] +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: build: