-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
63 lines (56 loc) · 1.57 KB
/
action.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: "Check WIP"
description: "Checks for WIP patterns in Titles"
branding:
icon: box
color: blue
inputs:
title:
description: "Text to perform pattern match against"
required: true
default: "${{ github.event.pull_request.title }}"
regex:
description: "Regex pattern to match in title"
required: true
# starts with zero or more leading whitespace chars, WIP and zero or more colons
default: "^[[:space:]]*(WIP)+(:)*"
debug:
description: "Enable verbose logging"
required: false
default: "false"
runs:
using: "composite"
steps:
- shell: bash
env:
TITLE: ${{ inputs.title }}
REGEX: ${{ inputs.regex }}
DEBUG: ${{ inputs.debug }}
run: |
set -e
if [[ ${DEBUG} == "true" ]]; then
echo "Enabling debug output"
set -x
fi
# TODO (@mgasch): make configurable
# case-insensitive
shopt -s nocasematch
if [[ -z ${TITLE} ]]; then
echo "::error::title input must be set";
exit 1
fi
if [[ -z ${REGEX} ]]; then
echo "::error::regex input must be set";
exit 1
fi
if [[ ${TITLE} =~ ${REGEX} ]]; then
echo "::error::Title marked as work in progress"
exit 1
else
echo "Title not marked as work in progress"
fi
# unset nocasematch option
shopt -u nocasematch
if [[ ${DEBUG} == "true" ]]; then
echo "Disabling debug output"
set +x
fi