-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (29 loc) · 1.37 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Configure New Repository
on:
push:
branches:
- main
permissions:
contents: write
jobs:
template:
runs-on: ubuntu-latest
if: ${{ github.event.created && github.repository != 'TheDayIsMyEnemy/BlazorTemplate' }}
steps:
- uses: actions/checkout@v4
- name: Rename files and folders
run: |
old_name='BlazorTemplate'
new_name=${{ github.event.repository.name }}
find . -maxdepth 2 -type d -name "$old_name*" -exec bash -c 'mv "{}" "$(echo "{}" | sed -e "s/'"${old_name}"'/'"${new_name}"'/")"' \;
find . -maxdepth 5 -type f \( -name '*.sln' -o -name '*.csproj' -o -name '*.cshtml' -o -name '*.razor' -o -name '*.cs' -o -name '*.md' \) -exec bash -c 'mv "{}" "$(echo "{}" | sed -e "s/'"${old_name}"'/'"${new_name}"'/")"' \;
find . -type f \( -name '*.sln' -o -name '*.csproj' -o -name '*.cshtml' -o -name '*.razor' -o -name '*.cs' -o -name '*.md' -o -name '*.json' \) -exec sed -i "s/$old_name/$new_name/g" {} +
find . -type f \( -name '*.sln' \) -exec sed -i "s/TheDayIsMyEnemy/${{ github.actor }}/g" {} +
rm .github/workflows/template.yml
- name: Commit changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add -A
git commit -m "Update project structure"
git push