Skip to content

Commit 745ca0e

Browse files
committed
fixes
1 parent cac41c4 commit 745ca0e

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/deploy-to-control-plane-review.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ jobs:
140140
app_name: ${{ env.APP_NAME }}
141141
org: ${{ env.CPLN_ORG }}
142142

143+
- name: Extract deployment URL
144+
id: extract-url
145+
run: |
146+
RAILS_URL=$(echo "${{ steps.deploy.outputs.deployment_output }}" | grep -o 'https://rails-[^[:space:]]*\.cpln\.app')
147+
echo "RAILS_URL=$RAILS_URL" >> $GITHUB_ENV
148+
echo "rails_url=$RAILS_URL" >> $GITHUB_OUTPUT
149+
150+
- name: Update PR commit message
151+
if: success()
152+
env:
153+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
run: |
155+
PR_SHA=$(gh pr view ${{ env.PR_NUMBER }} --json commits --jq '.commits[-1].oid')
156+
git config user.name "GitHub Actions"
157+
git config user.email "[email protected]"
158+
git pull --rebase
159+
git commit --amend -m "Rails review app deployed to ${{ env.RAILS_URL }}"
160+
git push --force-with-lease origin HEAD
161+
143162
- name: Update deployment status success
144163
if: success()
145164
uses: actions/github-script@v7
@@ -148,7 +167,7 @@ jobs:
148167
const message = `✅ Deployment successful!
149168
Environment: review-app
150169
Commit: ${context.sha.substring(0, 7)}
151-
URL: ${{ steps.deploy.outputs.app_url }}
170+
URL: ${{ env.RAILS_URL }}
152171
Status: ${process.env.statusUrl}`;
153172
154173
await github.rest.issues.createComment({
@@ -163,7 +182,7 @@ jobs:
163182
repo: context.repo.repo,
164183
deployment_id: ${{ steps.create-deployment.outputs.result }},
165184
state: 'success',
166-
environment_url: '${{ steps.deploy.outputs.app_url }}',
185+
environment_url: '${{ env.RAILS_URL }}',
167186
description: 'Deployment successful'
168187
});
169188

0 commit comments

Comments
 (0)