-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.44 KB
/
init.yml
File metadata and controls
55 lines (49 loc) · 1.44 KB
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
52
53
54
55
# .github/workflows/init.yml
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 != 'phimage/swift-cli-template'
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@v2
with:
files: .tmplr.yml
#
# Run tmplr with required environment variables,
# and remove the template recipe afterwards.
#
# Use this to get all the values you want from GitHub Action contexts
# and set them as environment variables for tmplr.
#
- name: Apply template
if: steps.template_exists.outputs.files_exists == 'true'
run: npx --yes 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