Skip to content

Commit a588346

Browse files
authored
Testing that Review App Deployment Workflow only redeploys on Pull Request Trigger (#645)
1 parent 75e06ab commit a588346

File tree

2 files changed

+13
-49
lines changed

2 files changed

+13
-49
lines changed

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

+12-48
Original file line numberDiff line numberDiff line change
@@ -113,68 +113,24 @@ jobs:
113113
# Check if app exists and save state
114114
if ! cpflow exists -a ${{ env.APP_NAME }}; then
115115
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
116-
exit 0
116+
echo "Canceling job as review app has not been previously deployed."
117117
fi
118118
echo "APP_EXISTS=false" >> $GITHUB_ENV
119119
else
120120
echo "APP_EXISTS=true" >> $GITHUB_ENV
121121
fi
122122
123-
- name: Validate Deployment Request
124-
id: validate
125-
run: |
126-
# Skip validation if deployment is already disabled
127-
if [[ "${{ env.DO_DEPLOY }}" == "false" ]]; then
128-
echo "Skipping validation - deployment already disabled"
129-
exit 0
130-
fi
131-
132-
if ! [[ "${{ github.event_name }}" == "workflow_dispatch" || \
133-
"${{ github.event_name }}" == "issue_comment" || \
134-
"${{ github.event_name }}" == "pull_request" || \
135-
"${{ github.event_name }}" == "push" ]]; then
136-
echo "Error: Unsupported event type ${{ github.event_name }}"
137-
exit 1
138-
fi
139-
140-
# Set DO_DEPLOY based on event type and conditions
141-
if [[ "${{ github.event_name }}" == "pull_request" && \
142-
("${{ github.event.action }}" == "opened" || \
143-
"${{ github.event.action }}" == "synchronize" || \
144-
"${{ github.event.action }}" == "reopened") ]]; then
145-
echo "DO_DEPLOY=true" >> $GITHUB_ENV
146-
elif [[ "${{ github.event_name }}" == "push" ]]; then
147-
echo "DO_DEPLOY=true" >> $GITHUB_ENV
148-
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
149-
echo "DO_DEPLOY=true" >> $GITHUB_ENV
150-
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
151-
if [[ "${{ github.event.issue.pull_request }}" ]]; then
152-
# Trim spaces and check for exact command
153-
COMMENT_BODY=$(echo "${{ github.event.comment.body }}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
154-
if [[ "$COMMENT_BODY" == "/deploy-review-app" ]]; then
155-
echo "DO_DEPLOY=true" >> $GITHUB_ENV
156-
else
157-
echo "DO_DEPLOY=false" >> $GITHUB_ENV
158-
echo "Skipping deployment - comment '$COMMENT_BODY' does not match '/deploy-review-app'"
159-
fi
160-
else
161-
echo "DO_DEPLOY=false" >> $GITHUB_ENV
162-
echo "Skipping deployment for non-PR comment"
163-
fi
164-
fi
165-
if [[ "${{ env.DO_DEPLOY }}" == "false" ]]; then
166-
exit 0
167-
fi
168-
169123
- name: Setup Control Plane App if Not Existing
170-
if: env.APP_EXISTS == 'false'
124+
if: env.APP_EXISTS == 'false' && github.event_name != 'pull_request'
171125
env:
172126
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
173127
run: |
174128
echo "🔧 Setting up new Control Plane app..."
175129
cpflow setup-app -a ${{ env.APP_NAME }} --org ${{ vars.CPLN_ORG_STAGING }}
130+
echo "APP_EXISTS=true" >> $GITHUB_ENV
176131
177132
- name: Create Initial Comment
133+
if: env.APP_EXISTS == 'true'
178134
uses: actions/github-script@v7
179135
id: create-comment
180136
with:
@@ -188,6 +144,7 @@ jobs:
188144
core.setOutput('comment-id', result.data.id);
189145
190146
- name: Set Deployment URLs
147+
if: env.APP_EXISTS == 'true'
191148
id: set-urls
192149
uses: actions/github-script@v7
193150
with:
@@ -219,6 +176,7 @@ jobs:
219176
);
220177
221178
- name: Initialize GitHub Deployment
179+
if: env.APP_EXISTS == 'true'
222180
uses: actions/github-script@v7
223181
id: init-deployment
224182
with:
@@ -248,6 +206,7 @@ jobs:
248206
return deployment.data.id;
249207
250208
- name: Update Status - Building
209+
if: env.APP_EXISTS == 'true'
251210
uses: actions/github-script@v7
252211
with:
253212
script: |
@@ -267,6 +226,7 @@ jobs:
267226
});
268227
269228
- name: Build Docker Image
229+
if: env.APP_EXISTS == 'true'
270230
id: build
271231
uses: ./.github/actions/build-docker-image
272232
with:
@@ -276,6 +236,7 @@ jobs:
276236
PR_NUMBER: ${{ env.PR_NUMBER }}
277237

278238
- name: Update Status - Deploying
239+
if: env.APP_EXISTS == 'true'
279240
uses: actions/github-script@v7
280241
with:
281242
script: |
@@ -297,13 +258,16 @@ jobs:
297258
});
298259
299260
- name: Deploy to Control Plane
261+
if: env.APP_EXISTS == 'true'
300262
run: cpflow deploy-image -a ${{ env.APP_NAME }} --run-release-phase --org ${{ vars.CPLN_ORG_STAGING }} --verbose
301263

302264
- name: Retrieve App URL
265+
if: env.APP_EXISTS == 'true'
303266
id: workload
304267
run: echo "WORKLOAD_URL=$(cpln workload get rails --gvc ${{ env.APP_NAME }} | tee | grep -oP 'https://[^[:space:]]*\.cpln\.app(?=\s|$)' | head -n1)" >> "$GITHUB_OUTPUT"
305268

306269
- name: Update Status - Deployment Complete
270+
if: env.APP_EXISTS == 'true'
307271
uses: actions/github-script@v7
308272
with:
309273
script: |

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class Footer extends BaseComponent {
1414
</a>
1515
<a href="https://x.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
17+
Rails On Maui on Twitter
1818
</a>
1919
</div>
2020
</footer>

0 commit comments

Comments
 (0)