Skip to content

Create a postcard

Create a postcard #8

Workflow file for this run

name: βœ‰οΈ Create Postcard Form Opened
on:
issues:
types:
- opened
- reopened
jobs:
extract_postcard_data:
name: πŸ•΅πŸ»β€β™‚οΈ Extract Postcard Data
if: |
contains(github.event.issue.labels.*.name, 'postcardbot')
runs-on: Ubuntu-latest
outputs:
postcard_payload : ${{ steps.issue_payload.outputs.payload }}
steps:
- name: πŸ•΅πŸ»β€β™‚οΈ Extract Form Data
id: issue_payload
uses: peter-murray/issue-forms-body-parser@v3
with:
separator: '###'
issue_id: ${{ github.event.issue.number }}
label_marker_start: '>>>'
label_marker_end: '<<<'
- name: πŸ–¨ Print parsed data
run: |
echo '${{ steps.issue_payload.outputs.payload }}' | jq .
echo '## Postcard data extracted successfully πŸ“' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```json' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.issue_payload.outputs.payload }}' | jq . >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
call-postcard-generator:
name: πŸ“‘ Invoke postcard generator
uses: ./.github/workflows/postcard_builder_workflow.yml
needs:
- extract_postcard_data
with:
json_payload: ${{ needs.extract_postcard_data.outputs.postcard_payload }}
postcard_template: ${{ fromJson(needs.extract_postcard_data.outputs.postcard_payload).postcard-type }}
postcard_reciever_name: ${{ fromJson(needs.extract_postcard_data.outputs.postcard_payload).postrard-reciever-name }}
upload-postcard-to-azure:
name: ☁️ Upload postcard to Azure
uses: ./.github/workflows/upload_file_to_azure_workflow.yml
needs:
- call-postcard-generator
with:
artifact_name: postcard.jpg
azure_storage_account_name: winterfestpostcards
azure_site_domain: 'z6.web.core.windows.net'
secrets: inherit
add-postcard-to-issue:
name: πŸ“¨ Add postcard to issue
needs:
- call-postcard-generator
- upload-postcard-to-azure
runs-on: Ubuntu-latest
steps:
- name: πŸ“¨ Add postcard to issue
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
Here is your postcard πŸ“¬:
![postcard](${{ needs.upload-postcard-to-azure.outputs.postcard_file_url }})
[Fullsize version is here](${{ needs.upload-postcard-to-azure.outputs.postcard_file_url }})