-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (98 loc) · 4.18 KB
/
complete-support-request-info.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Support Request - Complete Support Request Info
on:
issues:
types: [opened]
jobs:
trigger:
name: "Complete info"
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@main
- name: Parse the support request
uses: stefanbuck/github-issue-parser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/support-request.yml
- name: Print the fields
run: echo "${PARSER_FIELDS}"
# use env variables as per https://github.com/orgs/community/discussions/32012#discussioncomment-3558892
env:
PARSER_FIELDS: ${{ steps.issue-parser.outputs.jsonString }}
- name: Check Selected Robot
id: check-1
run: |
if [ "${ROBOT}" == "None" ]; then
echo "WARNING_BODY=- [ ] enter the Robot Name, adjust the Issue Title, and add the Robot Label." >> $GITHUB_OUTPUT
echo "trigger_warning=yes" >> $GITHUB_ENV
echo "ROBOT_NAME=Robot Name" >> $GITHUB_OUTPUT
else
echo "WARNING_BODY=- [x] enter the Robot Name." >> $GITHUB_OUTPUT
echo "ROBOT_NAME=${ROBOT}" >> $GITHUB_OUTPUT
echo "ROBOT_LABEL=${ROBOT}" >> $GITHUB_OUTPUT
fi
env:
ROBOT: ${{ steps.issue-parser.outputs.issueparser_robot }}
# Set issue title prefix according to selected Robot Name
- name: Update issue title
uses: actions-cool/issues-helper@v3
id: issue-updater-title
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
title: "${{ steps.check-1.outputs.ROBOT_NAME }} – ${{ github.event.issue.title }}"
update-mode: 'replace'
# Add Robot Label according to selected Robot Name
- name: Add robot label
uses: actions-cool/issues-helper@v3
id: issue-updater-label
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: ${{ steps.check-1.outputs.ROBOT_LABEL }}
- name: Check Issue Title
id: check-2
run: |
if [ "${ISSUE_TITLE}" == "" ] || [ "${ISSUE_TITLE}" == "${TITLE_PLACEHOLDER}" ] || [ "${{ steps.check-1.outputs.ROBOT_NAME }}" == "Robot Name" ]; then
echo "WARNING_BODY=- [ ] give the issue a meaningful Title." >> $GITHUB_OUTPUT
echo "trigger_warning=yes" >> $GITHUB_ENV
else
echo "WARNING_BODY=- [x] give the issue a meaningful Title." >> $GITHUB_OUTPUT
fi
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
TITLE_PLACEHOLDER: "[Give a meaningful title but don't enter the robot name here]"
- name: Check Issue Detailed Context
if: false
id: check-3
run: |
echo ${#CONTEXT}
if [ "${CONTEXT}" == "" ] || [ ${#CONTEXT} -lt 100 ]; then
echo "WARNING_BODY=- [ ] provide a Detailed Context (at least 100 characters)." >> $GITHUB_OUTPUT
echo "trigger_warning=yes" >> $GITHUB_ENV
else
echo "WARNING_BODY=- [x] provide a Detailed Context." >> $GITHUB_OUTPUT
fi
env:
CONTEXT: ${{ steps.issue-parser.outputs.issueparser_context }}
- name: Print URL of the problematic issue
if: (env.trigger_warning=='yes')
run: |
echo "❌ Problems detected with ${{ github.event.issue.html_url }}"
- name: Create comment
if: (env.trigger_warning=='yes')
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
## ⚠️ Detected missing mandatory information
Hi @${{ github.event.issue.user.login }} 👋🏻
Some of the following points need your attention.
You are required to:
${{ steps.check-1.outputs.WARNING_BODY }}
${{ steps.check-2.outputs.WARNING_BODY }}
<sub>Please, mark the points above as solved once done.</sub>
[^1]: To get to know the allowed options for the dropdown fields, you may peruse the [**`template`**](../blob/master/.github/ISSUE_TEMPLATE/support-request.yml).
reactions: 'confused'