Skip to content

A GitHub Action to automatically initialize repositories from a template, renaming files, replacing placeholders, and cleaning up setup workflows.

License

Notifications You must be signed in to change notification settings

aretw0/template-initializer

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template Initializer Action

License Release

AUTOMATICALLY initializes a new repository created from a template. This action checks if it is running in a new repository (not the original template), renames files, replaces placeholders, cleans up unwanted files, and self-destructs the setup workflow.

🚀 Features

  • Auto-Detection: Runs only when a new repository is created from the template.
  • File Renaming: Renames specific files (e.g., README_TEMPLATE.md to README.md).
  • Content Replacement: Automatically replaces {{REPO_NAME}} with the new repository name in renamed files.
  • Cleanup: Removes temporary files and the initialization workflow itself after execution.
  • Git Identity: Configures a bot user to commit changes.

📦 Usage

Add this action to a workflow file (e.g., .github/workflows/setup.yml) in your template repository.

name: Template Setup
on:
  push:
    branches:
      - main

jobs:
  setup:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Initialize Template
        uses: aretw0/template-initializer@v1
        with:
          template_repository: aretw0/my-template # REPLACE with your template repo
          workflow_filename: .github/workflows/setup.yml # The file identifying THIS workflow
          files_to_rename: "README_TEMPLATE.md:README.md" # Optional: Space separated list of old:new
          files_to_remove: "LICENSE-TEMPLATE" # Optional: Space separated list of files to remove

⚙️ Inputs

Input Description Required Default
template_repository The owner/repo of the original template. Prevents the action from checking out the template itself. Yes N/A
workflow_filename The path to the workflow file calling this action. It will be deleted after successful initialization. Yes N/A
files_to_rename A space-separated list of old_path:new_path pairs. Also replaces {{REPO_NAME}} in the new file. No ""
files_to_remove A space-separated list of files, directories, or glob patterns (e.g., docs/*.md) to delete. No ""
reset_changelog If true, resets CHANGELOG.md to a standard initial header. No false
reset_version If true, resets VERSION file to 0.0.1. No false
token GitHub token for authentication. No ${{ github.token }}

About

A GitHub Action to automatically initialize repositories from a template, renaming files, replacing placeholders, and cleaning up setup workflows.

Topics

Resources

License

Stars

Watchers

Forks