Skip to content

update tokens

update tokens #43

name: Configure New Repository
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
issues: read
packages: none
jobs:
configure:
runs-on: ubuntu-latest
if: ${{ github.event.created && github.repository != 'TheDayIsMyEnemy/BlazorTemplate' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Set repository name
id: repo_name
run: echo "::set-output name=name::${{ github.event.repository.name }}"
- name: Rename files and folders
run: |
find ../../ ! -path . -name '.*' -prune -o -type d -exec bash -c 'mv "{}" "$(echo "{}" | sed "s/BlazorTemplate/${{ steps.repo_name.outputs.name }}/")"' \;
find ../../ ! -path . -name '.*' -prune -o -type f \( -name '*.cs' -o -name '*.csproj' -o -name '*.sln' \) -exec bash -c 'mv "{}" "$(echo "{}" | sed "s/BlazorTemplate/${{ steps.repo_name.outputs.name }}/g")"' \;
find ../../ -type f \( -name '*.razor' -o -name '*.cshtml' -o -name '*.cs' -o -name '*.csproj' -o -name '*.sln' -o -name '*.md' \) -exec sed -i "s/BlazorTemplate/${{ steps.repo_name.outputs.name }}/g" {} +
- name: Remove setup files
run: rm .github/workflows/configure-new-repo.yml
# - name: Commit changes
# run: |
# git config user.name github-actions
# git config user.email github-actions@github.com
# git checkout -b "configure-new-repo"
# git add .
# git commit -m "Configure new repo"
# git push origin configure-new-repo
- name: Create pull request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT_TOKEN }}
commit-message: Configure new repo
title: Configure new repo
body: This pull request renames folders and namespaces to match the repository name.
branch: configure-new-repo
base: main
# delete-branch: true