Feature Request: Repository Template & Token Replacement for scaffolding

Hello all 👋

I am trying to use GitHub template repositories to help scaffold a project for new users, but it would be fantastic that placeholders in filenames and file contents could be auto replaced when a new repository made from a template repo.

For example replace js/{{ projectname }}.controller.js  to be js/MyNewRepo.controller.js  along with checking each files contents for the same placeholder too.

Current thoughts for a workaround

This is my current thoughts to the problem and how I may tackle it, happy for suggestions and or feedback

  • Build a new GitHub NodeJS action to help find and replace this in filenames and file contents
  • Have the template contain a workflow YML file - which will auto run the find & replace
  • Use exec  from  @actions/exec npm package to run native Git commands to commit & push the change back to the repo

Help needed

From some super rough work & initial tests it seems I cannot push the changes back to the repo. Here is the output from the logs of the GitHub Action being run

**git config --global user.email replace-bot@github.com git config --global user.name Find & Replace GitHub Action**** git status**On branch refs/heads/master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	deleted: README.md

Untracked files:
  (use "git add <file>..." to include in what will be committed)

no changes added to commit (use "git add" and/or "git commit -a")

**git commit -m Can we commit? -a** [refs/heads/master c1a47aa] Can we commit?
 1 file changed, 4 deletions(-)
 delete mode 100644 README.md

**git remote -v** origin	https://github.com/warrenbuckley/I-am-a-template (fetch)
origin	https://github.com/warrenbuckley/I-am-a-template (push)

**git push origin HEAD** fatal: could not read Username for 'https://github.com': No such device or address

Hi @warrenbuckley,

Thanks for this feedback! We’re always working to improve GitHub and the GitHub Community Forum, and we consider every suggestion we receive. I’ve logged your feature request in our internal feature request list. Though I can’t guarantee anything or share a timeline for this, I can tell you that it’s been shared with the appropriate teams for consideration.



Hi @belhfl are you able to give advice or pointers on how I can use git CLI inside a GitHub action please, whislt my idea/feature request is to be considered for template repos

Hi @warrenbuckley , I currently have the same question you had. Did you end up solving your issue or using a workaround?