forked from eclipse-openj9/openj9
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 2.06 KB
/
triggerTriagerx.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
name: Run when "triagerx" is mentioned in an issue comment
run-name: Triagerx Trigger
on:
issue_comment:
types: [created]
jobs:
triagerx_trigger:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, 'triagerx')
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
repository: eclipse-openj9/openj9
ref: master
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Node Version
run: node --version
- name: Install dependencies
run: npm install axios@0.28.0 @actions/github @actions/core
- name: Extract issue details
id: extract_issue
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commentBody = context.payload.comment.body;
const restCommentBody = commentBody.replace('triagerx', '');
let issueUrl = commentBody.includes('https') ? restCommentBody.trim() : context.payload.issue.html_url;
let issueNumber = issueUrl.split('/').pop();
let issueOwner = issueUrl.split('/')[3];
let issueRepo = issueUrl.split('/')[4];
const { data: issueData } = await github.issues.get({
issue_number: issueNumber,
owner: issueOwner,
repo: issueRepo
});
const issueTitle = issueData.title;
const issueDescription = issueData.body;
core.setOutput('issue_title', issueTitle);
core.setOutput('issue_description', issueDescription);
core.setOutput('issue_number', issueNumber);
- name: Run recommendations
run: node .github/recommendation.js
env:
ISSUE_TITLE: ${{ steps.extract_issue.outputs.issue_title }}
ISSUE_DESCRIPTION: ${{ steps.extract_issue.outputs.issue_description }}
ISSUE_NUMBER: ${{ steps.extract_issue.outputs.issue_number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}