Skip to content

Instantly share code, notes, and snippets.

@joshuapliatrio
Last active February 28, 2023 16:53
Show Gist options
  • Select an option

  • Save joshuapliatrio/d7a06bcef4e24120cb8e6607d66507c8 to your computer and use it in GitHub Desktop.

Select an option

Save joshuapliatrio/d7a06bcef4e24120cb8e6607d66507c8 to your computer and use it in GitHub Desktop.
An example of initializing a lab repo
name: Initialize repo
permissions:
contents: write
on:
create:
jobs:
initialize-repo:
if: github.event.repository.name != 'dojo-github-lab'
runs-on: ubuntu-latest
name: Initialize lab repo
steps:
- uses: actions/checkout@v3
- name: Update template files with new repo name
run: |
find ./ -type f -not -path "./.github/workflows/*" -exec sed -i -e 's/dojo-github-lab/${{github.event.repository.name}}/g' {} \;
- name: Commit updated files
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git add .
git commit -m "Initializing new repo"
git tag v1.0.0
git push --atomic origin ${{ github.ref_name }} v1.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment