-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (56 loc) · 2.17 KB
/
create-template.yml
File metadata and controls
68 lines (56 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
name: Create research computing training hackmd page
on:
push:
branches-ignore:
# don't trigger on main
- "main"
- "master"
- "dev*"
jobs:
build:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: set up split function
uses: rishabhgupta/split-by@v1
id: split
with:
string: ${{ steps.branch-name.outputs.current_branch }}
split-by: "-"
- name: Setup node and install hackmd-cli
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
- name: install hackmd-cli
shell: bash -l {0}
run: npm install -g @hackmd/hackmd-cli@2.0.2
- name: generate templates via jinja2
uses: cuchi/jinja2-action@v1.2.0
with:
template: templates/${{ steps.split.outputs._0}}.md.j2
output_file: ${{ steps.branch-name.outputs.current_branch }}.md
data_file: config.yaml
data_format: yaml # Will try to guess from the extension instead (unnecessary in this case)
- name: login to hackmd
shell: bash -l {0}
env:
HMD_API_ACCESS_TOKEN: ${{ secrets.HMD_API_ACCESS_TOKEN }}
run: |
hackmd-cli login
- name: export markdown file to hackmd
shell: bash -l {0}
id: hackmd-create
env:
HMD_API_ACCESS_TOKEN: ${{ secrets.HMD_API_ACCESS_TOKEN }}
run: |
echo "::set-output name=hackmd_link::$(cat ${{ steps.branch-name.outputs.current_branch }}.md | hackmd-cli notes create --columns=ID --output=csv --no-header)"
- name: Notify teams channel of created hackpad url
uses: jdcargile/ms-teams-notification@v1.3
with:
github-token: ${{ github.token }} # this will use the runner's token.
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
notification-summary: Hackpad created for ${{ steps.split.outputs._0 }} at https://hackmd.io/@research-computing-leeds/${{ steps.hackmd-create.outputs.hackmd_link }} ! 🎉
notification-color: 28a745