-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.28 KB
/
init.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Initialize Template
#
# Run this on creation of a branch or ref
#
on:
push:
branches: main
jobs:
build:
#
# Change this to make sure your workflow doesn't initialize on your template!
#
if: github.repository != 'loreanvictor/tmplr-template-example'
runs-on: ubuntu-latest
steps:
#
# Checkout the code
#
- uses: actions/checkout@v2
#
# Check if there is a template recipe
#
- id: template_exists
name: Check template
uses: andstor/file-existence-action@v1
with:
files: .tmplr.yml
#
# Run tmplr with required environment variables,
# and remove the template recipe afterwards.
#
- name: Apply template
if: steps.template_exists.outputs.files_exists == 'true'
run: npx tmplr && rm -fr .tmplr.yml && rm -fr .github/workflows/init.yml
env:
owner_name: ${{ github.event.repository.owner.name }}
owner_email: ${{ github.event.repository.owner.email }}
repo_name: ${{ github.event.repository.name }}
repo_url: ${{ github.event.repository.ssh_url }}
#
# Commit the code
#
- uses: EndBug/add-and-commit@v9
with:
message: Initialize from template