-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
76 lines (72 loc) · 2.52 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
64
65
66
67
68
69
70
71
72
73
74
75
76
name: 'Badgetizr'
description: 'Badgetizr adds visual badges and shortcuts to pull requests, streamlining code reviews and highlighting key details effortlessly.'
branding:
icon: 'award'
color: 'green'
inputs:
pr_id:
description: 'Specify the path to the configuration. Default is .badgetizr.yml'
required: true
configuration:
description: 'The path to the configuration. Default is .badgetizr.yml'
required: false
default: '.badgetizr.yml'
pr_destination_branch:
description: '(Mandatory when branch badge is enabled) Specify the pull request destination branch'
required: false
pr_build_number:
description: '(Mandatory when CI badge is enabled) Specify the pull request build number'
required: false
pr_build_url:
description: '(Mandatory when CI badge is enabled) Specify the pull request build url'
required: false
runs:
using: 'composite'
steps:
- name: Install dependencies
run: |
if [[ "$(uname)" == "Darwin" ]]; then
echo "Running on macOS"
if ! command -v gh &> /dev/null; then
echo "GitHub CLI (gh) not found. Installing..."
brew install gh
fi
if ! command -v yq &> /dev/null; then
echo "yq not found. Installing..."
brew install yq
fi
else
echo "Running on Linux"
if ! command -v gh &> /dev/null; then
echo "GitHub CLI (gh) not found. Installing..."
sudo apt-get update
sudo apt-get install -y gh
fi
if ! command -v yq &> /dev/null; then
echo "yq not found. Installing..."
sudo apt-get install -y yq
fi
fi
shell: bash
- name: "Execute Badgetizr"
run: |
pr_id="${{ inputs.pr_id }}"
configuration="${{ inputs.configuration }}"
pr_destination_branch="${{ inputs.pr_destination_branch }}"
pr_build_number="${{ inputs.pr_build_number }}"
pr_build_url="${{ inputs.pr_build_url }}"
options=""
if [ -n "$pr_id" ]; then
options="$options --pr-id=$pr_id"
fi
if [ -n "$pr_destination_branch" ]; then
options="$options --pr-destination-branch $pr_destination_branch"
fi
if [ -n "$pr_build_number" ]; then
options="$options --pr-build-number $pr_build_number"
fi
if [ -n "$pr_build_url" ]; then
options="$options --pr-build-url $pr_build_url"
fi
./badgetizr -c $configuration $options
shell: bash