Skip to content

Debug changes not showing up in review app #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 6 additions & 80 deletions .github/workflows/deploy-to-control-plane-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,10 @@ jobs:
steps:
# Initial checkout only for pull_request and push events
- name: Checkout code
if: github.event_name == 'pull_request' || github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}

# Basic checkout for other events (workflow_dispatch, issue_comment)
# We'll do proper checkout after getting PR info
- name: Initial checkout
if: github.event_name == 'workflow_dispatch' || github.event_name == 'issue_comment'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: github.sha

- name: Validate Required Secrets and Variables
shell: bash
Expand All @@ -80,71 +71,6 @@ jobs:
exit 1
fi

- name: Get PR HEAD Ref
id: getRef
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# For push events, try to find associated PR first
if [[ "${{ github.event_name }}" == "push" ]]; then
PR_DATA=$(gh pr list --head "${{ github.ref_name }}" --json number,headRefName,headRefOid --jq '.[0]')
if [[ -n "$PR_DATA" ]]; then
PR_NUMBER=$(echo "$PR_DATA" | jq -r .number)
else
echo "No PR found for branch ${{ github.ref_name }}, skipping deployment"
echo "DO_DEPLOY=false" >> $GITHUB_ENV
exit 0
fi
else
# Get PR number based on event type
case "${{ github.event_name }}" in
"workflow_dispatch")
PR_NUMBER="${{ github.event.inputs.pr_number }}"
;;
"issue_comment")
PR_NUMBER="${{ github.event.issue.number }}"
;;
"pull_request")
PR_NUMBER="${{ github.event.pull_request.number }}"
;;
*)
echo "Error: Unsupported event type ${{ github.event_name }}"
exit 1
;;
esac
fi

if [[ -z "$PR_NUMBER" ]]; then
echo "Error: Could not determine PR number"
echo "Event type: ${{ github.event_name }}"
echo "Event action: ${{ github.event.action }}"
echo "Ref name: ${{ github.ref_name }}"
echo "Available event data:"
echo "- PR number from inputs: ${{ github.event.inputs.pr_number }}"
echo "- PR number from issue: ${{ github.event.issue.number }}"
echo "- PR number from pull_request: ${{ github.event.pull_request.number }}"
exit 1
fi

# Get PR data
if [[ -z "$PR_DATA" ]]; then
PR_DATA=$(gh pr view "$PR_NUMBER" --json headRefName,headRefOid)
if [[ -z "$PR_DATA" ]]; then
echo "Error: PR DATA for PR #$PR_NUMBER not found"
echo "Event type: ${{ github.event_name }}"
echo "Event action: ${{ github.event.action }}"
echo "Ref name: ${{ github.ref_name }}"
echo "Attempted to fetch PR data with: gh pr view $PR_NUMBER"
exit 1
fi
fi

# Extract and set PR data
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "APP_NAME=${{ vars.REVIEW_APP_PREFIX }}-$PR_NUMBER" >> $GITHUB_ENV
echo "PR_REF=$(echo $PR_DATA | jq -r .headRefName)" >> $GITHUB_OUTPUT
echo "PR_SHA=$(echo $PR_DATA | jq -r .headRefOid)" >> $GITHUB_ENV

- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
Expand Down Expand Up @@ -272,7 +198,7 @@ jobs:
id: init-deployment
with:
script: |
const ref = process.env.PR_SHA;
const ref = github.sha;
const environment = process.env.ENVIRONMENT_NAME || 'review-app';

const deployment = await github.rest.repos.createDeployment({
Expand Down Expand Up @@ -301,7 +227,7 @@ jobs:
with:
script: |
const buildingMessage = [
'🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ env.PR_SHA }}',
'🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ github.sha }}',
'',
'📝 [View Build Logs](${{ env.WORKFLOW_URL }})',
'',
Expand All @@ -321,7 +247,7 @@ jobs:
with:
app_name: ${{ env.APP_NAME }}
org: ${{ vars.CPLN_ORG_STAGING }}
commit: ${{ env.PR_SHA }}
commit: ${{ github.sha }}
PR_NUMBER: ${{ env.PR_NUMBER }}

- name: Update Status - Deploying
Expand Down Expand Up @@ -380,7 +306,7 @@ jobs:

// Define messages based on deployment status
const successMessage = [
'✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}',
'✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ github.sha }}',
'',
'🚀 [Review App for PR #' + prNumber + '](' + appUrl + ')',
consoleLink,
Expand All @@ -389,7 +315,7 @@ jobs:
].join('\n');

const failureMessage = [
'❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}',
'❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ github.sha }}',
'',
consoleLink,
'',
Expand Down
4 changes: 2 additions & 2 deletions client/app/bundles/comments/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default class Footer extends BaseComponent {
Example of styling using image-url and Open Sans Light custom font
</h3>
</a>
<a href="https://twitter.com/railsonmaui" className="flex gap-4 items-center">
<a href="https://x.com/railsonmaui" className="flex gap-4 items-center">
<div className="w-16 h-16 bg-[url('../images/twitter_64.png')]" />
Rails On Maui on Twitter
Rails On Maui on X (Twitter)
</a>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ default: &default

development:
<<: *default
database: react-webpack-rails-tutoria-developmentl
database: react-webpack-rails-tutorial-development

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