name: Job messages ⚙️ on: workflow_call: inputs: branch: required: false type: string commit: required: true type: string preview_url: required: false type: string in_progress: required: true type: boolean comment: required: false type: boolean marker: description: Hidden marker to detect PR comments composed by the bot required: false type: string default: "CFPages-deployment" jobs: cf_pages_msg: name: CloudFlare Pages deployment 📃🚀 runs-on: ubuntu-latest steps: - name: Compose message 📃 if: ${{ always() }} id: compose env: COMMIT: ${{ inputs.commit }} PREVIEW_URL: ${{ inputs.preview_url != '' && (inputs.branch != 'master' && inputs.preview_url || format('https://jellyfin-web.pages.dev ({0})', inputs.preview_url)) || 'Not available' }} DEPLOY_STATUS: ${{ inputs.in_progress && '🔄 Deploying...' || (inputs.preview_url != '' && '✅ Deployed!' || '❌ Failure. Check workflow logs for details') }} DEPLOYMENT_TYPE: ${{ inputs.branch != 'master' && '🔀 Preview' || '⚙️ Production' }} WORKFLOW_RUN: ${{ !inputs.in_progress && format('**[View build logs](https://github.com/{0}/actions/runs/{1})**', github.repository, github.run_id) || '' }} # EOF is needed for multiline environment variables in a GitHub Actions context run: | echo "## Cloudflare Pages deployment" > $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "| **Latest commit** | ${COMMIT::7} |" >> $GITHUB_STEP_SUMMARY echo "|------------------------- |:----------------------------: |" >> $GITHUB_STEP_SUMMARY echo "| **Status** | $DEPLOY_STATUS |" >> $GITHUB_STEP_SUMMARY echo "| **Preview URL** | $PREVIEW_URL |" >> $GITHUB_STEP_SUMMARY echo "| **Type** | $DEPLOYMENT_TYPE |" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "$WORKFLOW_RUN" >> $GITHUB_STEP_SUMMARY COMPOSED_MSG=$(cat $GITHUB_STEP_SUMMARY) echo "msg<> $GITHUB_ENV echo "$COMPOSED_MSG" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - name: Push comment to Pull Request 🔼 uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0 if: ${{ inputs.comment && steps.compose.conclusion == 'success' }} with: github-token: ${{ secrets.JF_BOT_TOKEN }} message: ${{ env.msg }} comment-tag: ${{ inputs.marker }}