Create a postcard #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}) | |