Skip to content

Commit da09757

Browse files
junrushaoMasterJH5574
authored andcommitted
[CI] Add GitHub Action to Trigger Jenkins
1 parent c53a8d2 commit da09757

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
name: GitHub Command - \test
18+
19+
on:
20+
issue_comment:
21+
types: [created]
22+
23+
jobs:
24+
run_command:
25+
if: github.event.issue.pull_request && contains(github.event.comment.body, '\test')
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Get PR branch
29+
uses: xt0rted/pull-request-comment-branch@v2
30+
id: comment-branch
31+
- name: Set latest commit status as pending
32+
uses: myrotvorets/set-commit-status-action@master
33+
with:
34+
sha: ${{ steps.comment-branch.outputs.head_sha }}
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
status: pending
37+
- name: Checkout PR branch
38+
uses: actions/checkout@v3
39+
- name: Trigger
40+
env:
41+
JENKINS_USER: junrushao
42+
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
43+
JENKINS_JOB: https://ci.mlc.ai/job/mlc/job/PR-${{ github.event.issue.number }}
44+
run: |
45+
set -euxo pipefail
46+
BUILD_NUMBER=$(curl --fail -s -X GET $JENKINS_JOB/lastBuild/buildNumber)
47+
curl --fail -X POST -u $JENKINS_USER:$JENKINS_TOKEN $JENKINS_JOB/$BUILD_NUMBER/input/1/proceedEmpty
48+
- name: Set latest commit status as ${{ job.status }}
49+
uses: myrotvorets/set-commit-status-action@master
50+
if: always()
51+
with:
52+
sha: ${{ steps.comment-branch.outputs.head_sha }}
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
status: ${{ job.status }}

0 commit comments

Comments
 (0)