File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,33 @@ jobs:
126126 echo "All $MAX_ATTEMPTS Cloudflare Pages publish attempts failed."
127127 exit 1
128128
129+ - name : 🚀 Create GitHub Deployment for "View deployment" button
130+ if : inputs.checkout_repo == '' || inputs.checkout_repo == github.repository
131+ env :
132+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
133+ CF_URL : ${{ steps.cloudflare.outputs.url }}
134+ run : |
135+ if [ -z "$CF_URL" ]; then
136+ echo "No Cloudflare URL available, skipping deployment."
137+ exit 0
138+ fi
139+ DEPLOY_ID=$(gh api \
140+ -X POST \
141+ -H "Accept: application/vnd.github+json" \
142+ repos/${{ github.repository }}/deployments \
143+ -f ref="$(git rev-parse HEAD)" \
144+ -f environment="graphite-dev (Preview)" \
145+ -F auto_merge=false \
146+ -f required_contexts="[]" \
147+ --jq '.id')
148+ gh api \
149+ -X POST \
150+ -H "Accept: application/vnd.github+json" \
151+ repos/${{ github.repository }}/deployments/$DEPLOY_ID/statuses \
152+ -f state=success \
153+ -f environment_url="$CF_URL" \
154+ -f log_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
155+
129156 - name : 💬 Comment with the build link
130157 env :
131158 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments