From 98d9a9fc76e1df86b197dc233666238fe5da657d Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 9 Apr 2025 00:04:53 -0500 Subject: [PATCH 1/3] test --- client/app/bundles/comments/components/Footer/Footer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/bundles/comments/components/Footer/Footer.jsx b/client/app/bundles/comments/components/Footer/Footer.jsx index 94e98162..2cb65281 100644 --- a/client/app/bundles/comments/components/Footer/Footer.jsx +++ b/client/app/bundles/comments/components/Footer/Footer.jsx @@ -14,7 +14,7 @@ export default class Footer extends BaseComponent {
- Rails On Maui on Twitter + Rails On Maui on X (Twitter)
From 17761ebb17c1175bdfc8f4e204e6cb3f7508c818 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 9 Apr 2025 00:58:38 -0500 Subject: [PATCH 2/3] Revert "Debug changes not showing up in review app (#632)" This reverts commit 474cd5e36a3c2700d064c13092b5e2c29fb027df. --- .../deploy-to-control-plane-review-app.yml | 84 +++++++++++++++++-- .../comments/components/Footer/Footer.jsx | 4 +- config/database.yml | 2 +- 3 files changed, 82 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index eed57170..70ba2366 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -43,10 +43,19 @@ 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 @@ -72,6 +81,71 @@ 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: @@ -228,7 +302,7 @@ jobs: with: script: | const buildingMessage = [ - '🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ github.sha }}', + '🏗️ Building Docker image for PR #${{ env.PR_NUMBER }}, commit ${{ env.PR_SHA }}', '', '📝 [View Build Logs](${{ env.WORKFLOW_URL }})', '', @@ -248,7 +322,7 @@ jobs: with: app_name: ${{ env.APP_NAME }} org: ${{ vars.CPLN_ORG_STAGING }} - commit: ${{ github.sha }} + commit: ${{ env.PR_SHA }} PR_NUMBER: ${{ env.PR_NUMBER }} - name: Update Status - Deploying @@ -307,7 +381,7 @@ jobs: // Define messages based on deployment status const successMessage = [ - '✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ github.sha }}', + '✅ Deployment complete for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}', '', '🚀 [Review App for PR #' + prNumber + '](' + appUrl + ')', consoleLink, @@ -316,7 +390,7 @@ jobs: ].join('\n'); const failureMessage = [ - '❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ github.sha }}', + '❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ env.PR_SHA }}', '', consoleLink, '', diff --git a/client/app/bundles/comments/components/Footer/Footer.jsx b/client/app/bundles/comments/components/Footer/Footer.jsx index 2cb65281..011679b7 100644 --- a/client/app/bundles/comments/components/Footer/Footer.jsx +++ b/client/app/bundles/comments/components/Footer/Footer.jsx @@ -12,9 +12,9 @@ export default class Footer extends BaseComponent { Example of styling using image-url and Open Sans Light custom font - +
- Rails On Maui on X (Twitter) + Rails On Maui on Twitter
diff --git a/config/database.yml b/config/database.yml index 8f24b6e3..f0d105b2 100644 --- a/config/database.yml +++ b/config/database.yml @@ -31,7 +31,7 @@ default: &default development: <<: *default - database: react-webpack-rails-tutorial-development + database: react-webpack-rails-tutoria-developmentl # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". From 580aeae8d2197b5f319deac11849510ac0f85b75 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 9 Apr 2025 01:02:47 -0500 Subject: [PATCH 3/3] use the determined PR_SHA before checking out code --- .../deploy-to-control-plane-review-app.yml | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index 70ba2366..2d0102d1 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -41,21 +41,6 @@ jobs: contains(github.event.comment.body, '/deploy-review-app')) runs-on: ubuntu-latest 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 - name: Validate Required Secrets and Variables shell: bash @@ -145,6 +130,12 @@ jobs: 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: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ env.PR_SHA }} - name: Setup Environment uses: ./.github/actions/setup-environment