Update Long Discourses [epub] #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check and Rename Files | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
check-and-rename: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: sudo apt-get install -y rename | |
- name: Check and rename files | |
run: | | |
for file in $(find . -type f -name '*-*-*-*'); do | |
if [[ $file =~ ^.*-([0-9]{4}-[0-9]{2}-[0-9]{2}).*$ ]]; then | |
new_file=$(echo $file | sed -r 's/-[0-9]{4}-[0-9]{2}-[0-9]{2}//') | |
cp $file $new_file | |
fi | |
done | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'github-actions@github.com' | |
git add . | |
git commit -m "Copy and Rename files" | |
git push |