File tree Expand file tree Collapse file tree 6 files changed +40
-14
lines changed Expand file tree Collapse file tree 6 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 1111 - uses : actions/checkout@v3
1212 - uses : ./directory_md
1313 with :
14- language : C++
14+ language : scripts
1515 working-directory : .
1616 filetypes : .cpp,.hpp
1717 ignored-directories : ./test
Original file line number Diff line number Diff line change 1111 - uses : actions/checkout@v3
1212 - uses : ./directory_md
1313 with :
14- language : C++
14+ language : scripts
1515 working-directory : ./test
1616 filetypes : .cpp,.hpp
Original file line number Diff line number Diff line change 2727 uses : actions/setup-python@v4
2828 with :
2929 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'
3035 - name : Running the formatter
3136 shell : bash
3237 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:
77[3] - Ignored files or folders (optional; use " \" " ./<directory_name>" \" " )
88"
99
10- echo " Changed files:"
11-
12-
1310# Separate $2 value (filename types) if it has a comma
1411if [[ " $2 " == * " ," * ]];
1512then
16- string=" $2 "
13+ string=" $2 "
1714
18- str_value=${string#* ,}
19- str_value2=${string%% ,* }
15+ str_value=${string#* ,}
16+ str_value2=${string%% ,* }
2017else
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
2327fi
2428
29+ echo " Changed files:"
30+
2531IFS=$' \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 " )
2733do
2834 ignored_files=" $( echo " $3 " | tr " ," " \n" ) "
2935
Original file line number Diff line number Diff line change 11name : " Filename Formatter"
2- description : " Format filenames into the format acceptable by TheAlgorithms opganization"
2+ description : " Format filenames into the acceptable format by TheAlgorithms opganization"
33author : " TheAlgorithms"
44inputs :
55 filetypes :
1717 steps :
1818 - run : echo "${{ github.action_path }}" >> $GITHUB_PATH
1919 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'
2025 - name : Running the formatter
2126 shell : bash
2227 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