-
Notifications
You must be signed in to change notification settings - Fork 102
54 lines (50 loc) · 1.24 KB
/
workflow-tester2.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
name: Test 2
on:
workflow_dispatch:
inputs:
body:
description: ""
default: ""
required: false
test:
description: ""
default: "false"
required: false
pull_request_target:
jobs:
job1:
runs-on: ubuntu-latest
steps:
- name: replacement
run: |
VARIABLE=my-repo-test
echo "${VARIABLE//-/_}"
DB_NAME=$GITHUB_REPOSITORY
TEST="${DB_NAME//-/_}"
echo $TEST
check-body-length:
runs-on: ubuntu-latest
steps:
- name: check
env:
PRNUM: ${{ github.event.pull_request.number }}
PRBODY: ${{ github.event.pull_request.body }}
TESTBODY: ${{ github.event.inputs.body }}
TEST: ${{ github.event.inputs.test }}
run: |
if [ "$TEST" = "true" ]
then
PRBODY=$TESTBODY
fi
commentPR () {
if [ "$TEST" = "true" ]
then
echo "would comment: '${1}'"
else
gh pr comment $PRNUM -b "${1}"
fi
}
if [ "$PRBODY" = "" ]
then
commentPR "Thanks! Please add a body so we can better review your contribution."
fi