-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
action.yml
71 lines (62 loc) · 2.12 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
name: Github Action doc generator
description: Github Action doc generator
author: jackton1
inputs:
action:
description: 'Path to the action.yml file'
required: false
default: action.yml
col_max_width:
description: 'Max width of a column'
required: false
default: '1000'
col_max_words:
description: 'Max number of words per line in a column'
required: false
default: '6'
output:
description: 'Path to the output file'
required: false
default: README.md
input_columns:
description: 'List of Input columns names to display, default (display all columns)'
required: false
output_columns:
description: 'List of Output column names to display, default (display all columns)'
required: false
bin_path:
description: 'Path to the auto-doc binary'
required: false
runs:
using: 'composite'
steps:
- run: |
EXTRA_ARGS=""
BIN_PATH="${{ inputs.bin_path }}"
INPUT_COLUMNS=(${{ inputs.input_columns }})
OUTPUT_COLUMNS=(${{ inputs.output_columns }})
for input_column in ${INPUT_COLUMNS[@]}; do
EXTRA_ARGS="${EXTRA_ARGS} --inputColumns ${input_column}"
done
for output_column in ${OUTPUT_COLUMNS[@]}; do
EXTRA_ARGS="${EXTRA_ARGS} --outputColumns ${output_column}"
done
if [[ -z "$BIN_PATH" ]]; then
TEMP_DIR=$(mktemp -d)
curl -sf https://gobinaries.com/github.com/tj-actions/auto-doc | PREFIX=$TEMP_DIR sh
BIN_PATH="$TEMP_DIR/auto-doc"
fi
echo "::debug::Generating documentation using ${BIN_PATH}..."
echo "::debug::Extra args: ${EXTRA_ARGS}"
$BIN_PATH --action="${{ inputs.action }}" --output="${{ inputs.output }}" \
--colMaxWidth="${{ inputs.col_max_width }}" --colMaxWords="${{ inputs.col_max_words }}" \
${EXTRA_ARGS} && exit_status=$? || exit_status=$?
rm -f $BIN_PATH
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Error occurred running auto-doc"
exit $exit_status;
fi
shell: bash
branding:
icon: file-text
color: white