From fde34cfc5fd4ab5f0278fd573b47fbd448a49ab5 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 15:40:11 -0500 Subject: [PATCH 1/6] stop triggering review app deployment on opening of pr --- .github/workflows/deploy-to-control-plane-review-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index d0357491..e74ff70f 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -5,7 +5,7 @@ run-name: Deploy PR Review App - PR #${{ github.event.pull_request.number || git # Controls when the workflow will run on: pull_request: - types: [opened, synchronize, reopened] + types: [synchronize, reopened] issue_comment: types: [created] workflow_dispatch: From 7df2949fbc0b024967d6dcbf424e346e9628e3dd Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 15:42:00 -0500 Subject: [PATCH 2/6] remove push event references since redundant with PR synchronization --- .../deploy-to-control-plane-review-app.yml | 45 +++++++------------ 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index e74ff70f..7e4eca55 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -26,7 +26,6 @@ jobs: deploy: if: | (github.event_name == 'pull_request') || - (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'issue_comment' && github.event.issue.pull_request && @@ -41,34 +40,22 @@ jobs: 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 + # 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 if [[ -z "$PR_NUMBER" ]]; then echo "Error: Could not determine PR number" From f1af979ac7cc62f317811ee71ff49d37f1a2aed4 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 15:59:25 -0500 Subject: [PATCH 3/6] remove twitter reference --- 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 2cb65281..61c66df8 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 X (Twitter) + Rails On Maui on X
From ab2c72bcedcda54087d313bec697c40f35b05840 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 18:09:15 -0500 Subject: [PATCH 4/6] don't deploy on pull request trigger --- .../deploy-to-control-plane-review-app.yml | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index 7e4eca55..ea0f971c 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -32,6 +32,33 @@ jobs: contains(github.event.comment.body, '/deploy-review-app')) runs-on: ubuntu-latest steps: + - name: Setup Environment + uses: ./.github/actions/setup-environment + with: + token: ${{ secrets.CPLN_TOKEN_STAGING }} + org: ${{ vars.CPLN_ORG_STAGING }} + + - name: Check if Review App Exists + id: check-app + env: + CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} + run: | + # First check if cpflow exists + if ! command -v cpflow &> /dev/null; then + echo "Error: cpflow command not found" + exit 1 + fi + + # Check if app exists and save state + if ! cpflow exists -a ${{ env.APP_NAME }}; then + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + exit 0 + fi + echo "APP_EXISTS=false" >> $GITHUB_ENV + else + echo "APP_EXISTS=true" >> $GITHUB_ENV + fi + - name: Initial Checkout uses: actions/checkout@v4 @@ -93,30 +120,6 @@ jobs: with: ref: ${{ env.PR_SHA }} - - name: Setup Environment - uses: ./.github/actions/setup-environment - with: - token: ${{ secrets.CPLN_TOKEN_STAGING }} - org: ${{ vars.CPLN_ORG_STAGING }} - - - name: Check if Review App Exists - id: check-app - env: - CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} - run: | - # First check if cpflow exists - if ! command -v cpflow &> /dev/null; then - echo "Error: cpflow command not found" - exit 1 - fi - - # Check if app exists and save state - if ! cpflow exists -a ${{ env.APP_NAME }}; then - echo "APP_EXISTS=false" >> $GITHUB_ENV - else - echo "APP_EXISTS=true" >> $GITHUB_ENV - fi - - name: Validate Deployment Request id: validate run: | From 893619ad189a5ea920f34120412e03d4974edcb5 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 18:14:12 -0500 Subject: [PATCH 5/6] update help --- .github/workflows/help-command.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index 51ce2566..282d2bd8 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -27,7 +27,7 @@ jobs: const sections = { commands: { deploy: { - title: '## `/deploy`', + title: '## `/deploy-review-app`', purpose: '**Purpose:** Deploy a review app for your pull request', details: [ '**What it does:**', @@ -43,7 +43,7 @@ jobs: ] }, destroy: { - title: '## `/destroy`', + title: '## `/delete-review-app`', purpose: '**Purpose:** Remove the review app for your pull request', details: [ '**What it does:**', @@ -94,9 +94,9 @@ jobs: cleanup: { title: '## Automatic Cleanup', details: [ - 'Review apps are automatically destroyed when:', + 'Review apps are automatically deleted when:', '1. The pull request is closed', - '2. The `/destroy` command is used', + '2. The `/delete-review-app` command is used', '3. A new deployment is requested (old one is cleaned up first)' ] }, From 92382fa79e47b44b008f80bdc659bcc8d8cce880 Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Wed, 30 Apr 2025 18:22:31 -0500 Subject: [PATCH 6/6] make sure to checkout right ref before setup --- .../deploy-to-control-plane-review-app.yml | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index ea0f971c..16c3e185 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -32,33 +32,6 @@ jobs: contains(github.event.comment.body, '/deploy-review-app')) runs-on: ubuntu-latest steps: - - name: Setup Environment - uses: ./.github/actions/setup-environment - with: - token: ${{ secrets.CPLN_TOKEN_STAGING }} - org: ${{ vars.CPLN_ORG_STAGING }} - - - name: Check if Review App Exists - id: check-app - env: - CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} - run: | - # First check if cpflow exists - if ! command -v cpflow &> /dev/null; then - echo "Error: cpflow command not found" - exit 1 - fi - - # Check if app exists and save state - if ! cpflow exists -a ${{ env.APP_NAME }}; then - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - exit 0 - fi - echo "APP_EXISTS=false" >> $GITHUB_ENV - else - echo "APP_EXISTS=true" >> $GITHUB_ENV - fi - - name: Initial Checkout uses: actions/checkout@v4 @@ -120,6 +93,33 @@ jobs: with: ref: ${{ env.PR_SHA }} + - name: Setup Environment + uses: ./.github/actions/setup-environment + with: + token: ${{ secrets.CPLN_TOKEN_STAGING }} + org: ${{ vars.CPLN_ORG_STAGING }} + + - name: Check if Review App Exists + id: check-app + env: + CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} + run: | + # First check if cpflow exists + if ! command -v cpflow &> /dev/null; then + echo "Error: cpflow command not found" + exit 1 + fi + + # Check if app exists and save state + if ! cpflow exists -a ${{ env.APP_NAME }}; then + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + exit 0 + fi + echo "APP_EXISTS=false" >> $GITHUB_ENV + else + echo "APP_EXISTS=true" >> $GITHUB_ENV + fi + - name: Validate Deployment Request id: validate run: |