forked from cossssmin/gridsome-starter-bleda
-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (60 loc) · 2.25 KB
/
pr.yaml
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
67
68
69
70
71
name: Pull Request
on:
pull_request:
branches:
- dev
types:
- opened
# - edited
# - synchronize
jobs:
schedule_publish:
name: Schedule publish
runs-on: ubuntu-latest
steps:
# - name: Check event payload
# shell: bash
# run: |
# echo ${{ toJSON(github.event) }}
- name: Check pr body
id: prbody
shell: bash
run: |
echo ::set-output name=value::$(echo ${{ toJSON(github.event.pull_request.body) }})
- name: Check environment variables
shell: bash
run: |
echo "Published: ${{ steps.prbody.outputs.value }}"
- name: Extract frontmatter from PR body
id: frontmatter
uses: aliencube/frontmatter-to-json-actions@v1
with:
markdown: '${{ toJSON(steps.prbody.outputs.value) }}'
- name: Check the frontmatter outputs
shell: bash
run: |
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq "."
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".schedule"
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".slug"
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".twitter"
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".facebook"
echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".linkedin"
- name: Get publish schedule
id: schedule
shell: bash
run: |
schedule=$(TZ=Asia/Seoul date --date $(echo ${{ toJSON(steps.frontmatter.outputs.jsonised) }} | jq -r ".schedule") --iso-8601=s)
echo ::set-output name=value::$schedule
# - name: Get owner and repository
# uses: jungwinter/split@v1
# id: split
# with:
# msg: ${{ github.event.repository.full_name) }}
# separator: '/'
- name: Schedule publish
shell: bash
run: |
curl -X POST 'https://${{ secrets.AZURE_FUNCTIONS_NAME }}.azurewebsites.net/api/orchestrators/schedule-event' \
-H "x-functions-key: ${{ secrets.AZURE_FUNCTIONS_KEY }}" \
-H "Content-Type: application/json" \
-d '{ "owner": "devkimchi", "repository": "blog", "issueId": ${{ github.event.pull_request.number }}, "schedule": "${{ steps.schedule.outputs.value }}" }} }'