Skip to content

An algorithm for determining the number of possible rearrangements of a string #229

An algorithm for determining the number of possible rearrangements of a string

An algorithm for determining the number of possible rearrangements of a string #229

name: Directory/Filename Formatter workflow
on: [push, pull_request]
jobs:
main:
name: (Directory) Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Git configuration
run: |
git config --global user.name 'autoprettier'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
- name: Filename Formatter
run: |
IFS=$'\n'
for fname in `find . -type f -name '*.R' -o -name '*.R'`
do
echo "${fname}"
new_fname=`echo ${fname} | tr ' ' '_'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr '-' '_'`
echo " ${new_fname}"
if [ ${fname} != ${new_fname} ]
then
echo " ${fname} --> ${new_fname}"
git "mv" "${fname}" ${new_fname}
fi
done
git commit -am "Formatting filenames ${GITHUB_SHA::8}" || true
- name: Update DIRECTORY.md
run: |
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/build_directory_md.py
python3 build_directory_md.py R . .R,.r > DIRECTORY.md
git diff
git commit -m "Update DIRECTORY.md" DIRECTORY.md || true
git push --force origin HEAD:$GITHUB_REF || true