Skip to content

Commit 17761eb

Browse files
committed
Revert "Debug changes not showing up in review app (#632)"
This reverts commit 474cd5e.
1 parent 98d9a9f commit 17761eb

File tree

3 files changed

+82
-8
lines changed

3 files changed

+82
-8
lines changed

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

+79-5
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ jobs:
4343
steps:
4444
# Initial checkout only for pull_request and push events
4545
- name: Checkout code
46+
if: github.event_name == 'pull_request' || github.event_name == 'push'
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
51+
52+
# Basic checkout for other events (workflow_dispatch, issue_comment)
53+
# We'll do proper checkout after getting PR info
54+
- name: Initial checkout
55+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'issue_comment'
4656
uses: actions/checkout@v4
4757
with:
4858
fetch-depth: 0
49-
ref: ${{ github.sha }}
5059

5160
- name: Validate Required Secrets and Variables
5261
shell: bash
@@ -72,6 +81,71 @@ jobs:
7281
exit 1
7382
fi
7483
84+
- name: Get PR HEAD Ref
85+
id: getRef
86+
env:
87+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: |
89+
# For push events, try to find associated PR first
90+
if [[ "${{ github.event_name }}" == "push" ]]; then
91+
PR_DATA=$(gh pr list --head "${{ github.ref_name }}" --json number,headRefName,headRefOid --jq '.[0]')
92+
if [[ -n "$PR_DATA" ]]; then
93+
PR_NUMBER=$(echo "$PR_DATA" | jq -r .number)
94+
else
95+
echo "No PR found for branch ${{ github.ref_name }}, skipping deployment"
96+
echo "DO_DEPLOY=false" >> $GITHUB_ENV
97+
exit 0
98+
fi
99+
else
100+
# Get PR number based on event type
101+
case "${{ github.event_name }}" in
102+
"workflow_dispatch")
103+
PR_NUMBER="${{ github.event.inputs.pr_number }}"
104+
;;
105+
"issue_comment")
106+
PR_NUMBER="${{ github.event.issue.number }}"
107+
;;
108+
"pull_request")
109+
PR_NUMBER="${{ github.event.pull_request.number }}"
110+
;;
111+
*)
112+
echo "Error: Unsupported event type ${{ github.event_name }}"
113+
exit 1
114+
;;
115+
esac
116+
fi
117+
118+
if [[ -z "$PR_NUMBER" ]]; then
119+
echo "Error: Could not determine PR number"
120+
echo "Event type: ${{ github.event_name }}"
121+
echo "Event action: ${{ github.event.action }}"
122+
echo "Ref name: ${{ github.ref_name }}"
123+
echo "Available event data:"
124+
echo "- PR number from inputs: ${{ github.event.inputs.pr_number }}"
125+
echo "- PR number from issue: ${{ github.event.issue.number }}"
126+
echo "- PR number from pull_request: ${{ github.event.pull_request.number }}"
127+
exit 1
128+
fi
129+
130+
# Get PR data
131+
if [[ -z "$PR_DATA" ]]; then
132+
PR_DATA=$(gh pr view "$PR_NUMBER" --json headRefName,headRefOid)
133+
if [[ -z "$PR_DATA" ]]; then
134+
echo "Error: PR DATA for PR #$PR_NUMBER not found"
135+
echo "Event type: ${{ github.event_name }}"
136+
echo "Event action: ${{ github.event.action }}"
137+
echo "Ref name: ${{ github.ref_name }}"
138+
echo "Attempted to fetch PR data with: gh pr view $PR_NUMBER"
139+
exit 1
140+
fi
141+
fi
142+
143+
# Extract and set PR data
144+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
145+
echo "APP_NAME=${{ vars.REVIEW_APP_PREFIX }}-$PR_NUMBER" >> $GITHUB_ENV
146+
echo "PR_REF=$(echo $PR_DATA | jq -r .headRefName)" >> $GITHUB_OUTPUT
147+
echo "PR_SHA=$(echo $PR_DATA | jq -r .headRefOid)" >> $GITHUB_ENV
148+
75149
- name: Setup Environment
76150
uses: ./.github/actions/setup-environment
77151
with:
@@ -228,7 +302,7 @@ jobs:
228302
with:
229303
script: |
230304
const buildingMessage = [
231-
'🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ github.sha }}',
305+
'🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ env.PR_SHA }}',
232306
'',
233307
'📝 [View Build Logs](${{ env.WORKFLOW_URL }})',
234308
'',
@@ -248,7 +322,7 @@ jobs:
248322
with:
249323
app_name: ${{ env.APP_NAME }}
250324
org: ${{ vars.CPLN_ORG_STAGING }}
251-
commit: ${{ github.sha }}
325+
commit: ${{ env.PR_SHA }}
252326
PR_NUMBER: ${{ env.PR_NUMBER }}
253327

254328
- name: Update Status - Deploying
@@ -307,7 +381,7 @@ jobs:
307381
308382
// Define messages based on deployment status
309383
const successMessage = [
310-
'✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ github.sha }}',
384+
'✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}',
311385
'',
312386
'🚀 [Review App for PR #' + prNumber + '](' + appUrl + ')',
313387
consoleLink,
@@ -316,7 +390,7 @@ jobs:
316390
].join('\n');
317391
318392
const failureMessage = [
319-
'❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ github.sha }}',
393+
'❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}',
320394
'',
321395
consoleLink,
322396
'',

client/app/bundles/comments/components/Footer/Footer.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export default class Footer extends BaseComponent {
1212
Example of styling using image-url and Open Sans Light custom font
1313
</h3>
1414
</a>
15-
<a href="https://x.com/railsonmaui" className="flex gap-4 items-center">
15+
<a href="https://twitter.com/railsonmaui" className="flex gap-4 items-center">
1616
<div className="w-16 h-16 bg-[url('../images/twitter_64.png')]" />
17-
Rails On Maui on X (Twitter)
17+
Rails On Maui on Twitter
1818
</a>
1919
</div>
2020
</footer>

config/database.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ default: &default
3131

3232
development:
3333
<<: *default
34-
database: react-webpack-rails-tutorial-development
34+
database: react-webpack-rails-tutoria-developmentl
3535

3636
# Warning: The database defined as "test" will be erased and
3737
# re-generated from your development database when you run "rake".

0 commit comments

Comments
 (0)