Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active May 6, 2020 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/b1793b9fe678641de6308b956c3d77d1 to your computer and use it in GitHub Desktop.
Save justinyoo/b1793b9fe678641de6308b956c3d77d1 to your computer and use it in GitHub Desktop.
Publishing JAM Stack Web Apps with GitOps and GitHub Actions
name: Pull Request
on:
pull_request:
branches:
- dev
types:
- opened
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=published::$(echo ${{ toJSON(github.event.pull_request.body) }} | sed 's!published: !!g' | sed 's!\\r\\n!!g')
- name: Check environment variables
shell: bash
run: |
echo "Published: ${{ steps.prbody.outputs.published }}"
- name: Schedule publish
shell: bash
run: |
curl -X POST 'https://${{ secrets.AZURE_FUNCTIONS_NAME }}.azurewebsites.net/api/orchestrators/schedule-event' \
-d '{ "owner": "aliencube", "repository": "blog", "issueId": ${{ github.event.pull_request.number }}, "schedule": "${{ steps.prbody.outputs.published }}" }} }' \
-H "x-functions-key: ${{ secrets.AZURE_FUNCTIONS_KEY }}" \
-H "Content-Type: application/json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment