Skip to content

Add new post

Add new post #60

Workflow file for this run

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 }}" }} }'