-
Notifications
You must be signed in to change notification settings - Fork 9
/
action.yml
84 lines (72 loc) · 3.05 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
77
78
79
80
81
82
83
84
name: 'codeowners-generator'
description: 'CODEOWNERS generator for mono-repos. This action will run codeowners-generator on your project and apply changes'
inputs:
use-maintainers:
description: 'For every package.json found, generate a CODEOWNERS entry using the maintainers field'
required: false
default: 'false'
group-source-comments:
description: 'Instead of generating one comment per rule, enabling this flag will group them, reducing comments to one per source file. Useful if your codeowners file gets too noisy'
required: false
default: 'false'
custom-regeneration-command:
description: 'Specify a custom regeneration command to be printed in the generated CODEOWNERS file, it should be mapped to run codeowners-generator'
required: false
default: 'false'
check:
description: It will fail if the CODEOWNERS generated does not match the current (or missing) CODEOWNERS. Useful for validating that the CODEOWNERS file is up to date during CI.'
required: false
default: 'false'
output:
description: 'The output path and name of the file, (default: CODEOWNERS)'
required: false
default: 'CODEOWNERS'
preserve-block-position:
description: Keep the generated block in the same position it was found in the CODEOWNERS file (if present). Useful for when you make manual additions.
required: false
default: 'false'
includes:
description: The glob used to find CODEOWNERS files in the repo. Defaults to the value in src/utils/constants.ts
required: false
default: ''
version:
description: codeowners-generator version. It will default to the latest in npm otherwise'
required: false
runs:
using: 'composite'
steps:
- id: get-input
shell: bash
run: |
ARGS_INPUT=("--output ${{inputs.output}}")
VERSION='latest'
if [ "${{inputs.use-maintainers}}" = "true" ]; then
ARGS_INPUT+=("--use-maintainers")
fi
if [ "${{inputs.use-maintainers}}" = "true" ]; then
ARGS_INPUT+=("--use-root-maintainers")
fi
if [ "${{inputs.group-source-comments}}" = "true" ]; then
ARGS_INPUT+=("--group-source-comments")
fi
if [ "${{inputs.custom-regeneration-command}}" = "true" ]; then
ARGS_INPUT+=("--custom-regeneration-command")
fi
if [ "${{inputs.check}}" = "true" ]; then
ARGS_INPUT+=("--check")
fi
if [ "${{inputs.preserve-block-position}}" = "true" ]; then
ARGS_INPUT+=("--preserve-block-position")
fi
if [ "${{inputs.includes}}" ]; then
ARGS_INPUT+=("--includes ${{inputs.includes}}")
fi
if [ ! -z "${{inputs.version}}" ]; then
VERSION="${{inputs.version}}"
fi
echo "Arguments we will use: ${ARGS_INPUT[@]}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "args-input=${ARGS_INPUT[@]}" >> $GITHUB_OUTPUT
- shell: bash
run: |
npx codeowners-generator@${{steps.get-input.outputs.version}} generate ${{steps.get-input.outputs.args-input}}