File tree 6 files changed +40
-14
lines changed
6 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 11
11
- uses : actions/checkout@v3
12
12
- uses : ./directory_md
13
13
with :
14
- language : C++
14
+ language : scripts
15
15
working-directory : .
16
16
filetypes : .cpp,.hpp
17
17
ignored-directories : ./test
Original file line number Diff line number Diff line change 11
11
- uses : actions/checkout@v3
12
12
- uses : ./directory_md
13
13
with :
14
- language : C++
14
+ language : scripts
15
15
working-directory : ./test
16
16
filetypes : .cpp,.hpp
Original file line number Diff line number Diff line change 27
27
uses : actions/setup-python@v4
28
28
with :
29
29
python-version : ' 3.10' # or whatever version you support
30
+ - name : Setup Git configurations
31
+ shell : bash
32
+ run : |
33
+ git config --global user.name github-actions[bot]
34
+ git config --global user.email 'github-actions@users.noreply.github.com'
30
35
- name : Running the formatter
31
36
shell : bash
32
37
run : |
33
- python ../build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md
38
+ python ./build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md
39
+ - name : Committing changes
40
+ shell : bash
41
+ run : |
42
+ git commit -m "chore: update `DIRECTORY.md`" DIRECTORY.md || true
43
+ git push origin HEAD:$GITHUB_REF || true
Original file line number Diff line number Diff line change @@ -7,23 +7,29 @@ echo -e "Arguments:
7
7
[3] - Ignored files or folders (optional; use " \" " ./<directory_name>" \" " )
8
8
"
9
9
10
- echo " Changed files:"
11
-
12
-
13
10
# Separate $2 value (filename types) if it has a comma
14
11
if [[ " $2 " == * " ," * ]];
15
12
then
16
- string=" $2 "
13
+ string=" $2 "
17
14
18
- str_value=${string#* ,}
19
- str_value2=${string%% ,* }
15
+ str_value=${string#* ,}
16
+ str_value2=${string%% ,* }
20
17
else
21
- str_value=" $2 "
22
- str_value2=" $2 "
18
+ str_value=" $2 "
19
+ str_value2=" $2 "
20
+ fi
21
+
22
+ # Do not run script if there are no given arguments.
23
+ if [[ " $1 " == " " ]] || [[ " $2 " == " " ]];
24
+ then
25
+ echo " No arguments given. Please specify minimum two arguments."
26
+ exit 1
23
27
fi
24
28
29
+ echo " Changed files:"
30
+
25
31
IFS=$' \n ' ; set -f
26
- for fname in ` find $1 -type f -name " $str_value2 " -o -name " $str_value " `
32
+ for fname in $( find $1 -type f -name " * $str_value2 " -or -name " * $str_value " )
27
33
do
28
34
ignored_files=" $( echo " $3 " | tr " ," " \n" ) "
29
35
Original file line number Diff line number Diff line change 1
1
name : " Filename Formatter"
2
- description : " Format filenames into the format acceptable by TheAlgorithms opganization"
2
+ description : " Format filenames into the acceptable format by TheAlgorithms opganization"
3
3
author : " TheAlgorithms"
4
4
inputs :
5
5
filetypes :
17
17
steps :
18
18
- run : echo "${{ github.action_path }}" >> $GITHUB_PATH
19
19
shell : bash
20
+ - name : Setup Git configurations
21
+ shell : bash
22
+ run : |
23
+ git config --global user.name github-actions[bot]
24
+ git config --global user.email 'github-actions@users.noreply.github.com'
20
25
- name : Running the formatter
21
26
shell : bash
22
27
run : |
23
- ../filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }}
28
+ ./filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }}
29
+ - name : Committing changes
30
+ shell : bash
31
+ run : |
32
+ git commit -m "chore: formatting filenames`" DIRECTORY.md || true
33
+ git push origin HEAD:$GITHUB_REF || true
You can’t perform that action at this time.
0 commit comments