Skip to content
  • Sponsor TheAlgorithms/TypeScript

  • Notifications You must be signed in to change notification settings
  • Fork 416
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aab3f30

Browse files
authoredOct 29, 2022
feat: add filename formatter and directory workflow (#76)
1 parent 69767aa commit aab3f30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+107
-27
lines changed
 
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Directory/Filename Formatter workflow
2+
on: [push, pull_request]
3+
4+
jobs:
5+
main:
6+
name: (Directory) Formatter
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@main
10+
- name: Setup Git configuration
11+
run: |
12+
git config --global user.name 'autoprettier'
13+
git config --global user.email 'actions@github.com'
14+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
15+
- name: Filename Formatter
16+
run: |
17+
IFS=$'\n'
18+
for fname in `find . -type f -name '*.ts' -o -name '*.ts'`
19+
do
20+
echo "${fname}"
21+
new_fname=`echo ${fname} | tr ' ' '_'`
22+
echo " ${new_fname}"
23+
new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'`
24+
echo " ${new_fname}"
25+
new_fname=`echo ${new_fname} | tr '-' '_'`
26+
echo " ${new_fname}"
27+
if [ ${fname} != ${new_fname} ]
28+
then
29+
echo " ${fname} --> ${new_fname}"
30+
git "mv" "${fname}" ${new_fname}
31+
fi
32+
done
33+
git commit -am "Formatting filenames ${GITHUB_SHA::8}" || true
34+
- name: Update DIRECTORY.md
35+
run: |
36+
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/build_directory_md.py
37+
python3 build_directory_md.py TypeScript . .ts jest.config.ts,sorts/test,search/test,maths/test,dynamic_programming/test,data_structures/test,ciphers/test > DIRECTORY.md
38+
39+
git diff
40+
git commit -m "Update DIRECTORY.md" DIRECTORY.md || true
41+
git push --force origin HEAD:$GITHUB_REF || true

‎DIRECTORY.md

Lines changed: 39 additions & 0 deletions

0 commit comments

Comments
 (0)
Please sign in to comment.