Skip to content

pat_token secret

pat_token secret #38

name: Configure New Repository
on:
push:
branches:
- main
permissions: write-all
jobs:
configure:
runs-on: ubuntu-latest
if: ${{ github.event.created && github.repository != 'TheDayIsMyEnemy/BlazorTemplate' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: Create pull request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT_TOKEN || github.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