diff --git a/.github/workflows/deploy-to-control-plane-review-app.yml b/.github/workflows/deploy-to-control-plane-review-app.yml index 16c3e185..63b5209e 100644 --- a/.github/workflows/deploy-to-control-plane-review-app.yml +++ b/.github/workflows/deploy-to-control-plane-review-app.yml @@ -113,68 +113,24 @@ jobs: # Check if app exists and save state if ! cpflow exists -a ${{ env.APP_NAME }}; then if [[ "${{ github.event_name }}" == "pull_request" ]]; then - exit 0 + echo "Canceling job as review app has not been previously deployed." fi echo "APP_EXISTS=false" >> $GITHUB_ENV else echo "APP_EXISTS=true" >> $GITHUB_ENV fi - - name: Validate Deployment Request - id: validate - run: | - # Skip validation if deployment is already disabled - if [[ "${{ env.DO_DEPLOY }}" == "false" ]]; then - echo "Skipping validation - deployment already disabled" - exit 0 - fi - - if ! [[ "${{ github.event_name }}" == "workflow_dispatch" || \ - "${{ github.event_name }}" == "issue_comment" || \ - "${{ github.event_name }}" == "pull_request" || \ - "${{ github.event_name }}" == "push" ]]; then - echo "Error: Unsupported event type ${{ github.event_name }}" - exit 1 - fi - - # Set DO_DEPLOY based on event type and conditions - if [[ "${{ github.event_name }}" == "pull_request" && \ - ("${{ github.event.action }}" == "opened" || \ - "${{ github.event.action }}" == "synchronize" || \ - "${{ github.event.action }}" == "reopened") ]]; then - echo "DO_DEPLOY=true" >> $GITHUB_ENV - elif [[ "${{ github.event_name }}" == "push" ]]; then - echo "DO_DEPLOY=true" >> $GITHUB_ENV - elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "DO_DEPLOY=true" >> $GITHUB_ENV - elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then - if [[ "${{ github.event.issue.pull_request }}" ]]; then - # Trim spaces and check for exact command - COMMENT_BODY=$(echo "${{ github.event.comment.body }}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') - if [[ "$COMMENT_BODY" == "/deploy-review-app" ]]; then - echo "DO_DEPLOY=true" >> $GITHUB_ENV - else - echo "DO_DEPLOY=false" >> $GITHUB_ENV - echo "Skipping deployment - comment '$COMMENT_BODY' does not match '/deploy-review-app'" - fi - else - echo "DO_DEPLOY=false" >> $GITHUB_ENV - echo "Skipping deployment for non-PR comment" - fi - fi - if [[ "${{ env.DO_DEPLOY }}" == "false" ]]; then - exit 0 - fi - - name: Setup Control Plane App if Not Existing - if: env.APP_EXISTS == 'false' + if: env.APP_EXISTS == 'false' && github.event_name != 'pull_request' env: CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} run: | echo "🔧 Setting up new Control Plane app..." cpflow setup-app -a ${{ env.APP_NAME }} --org ${{ vars.CPLN_ORG_STAGING }} + echo "APP_EXISTS=true" >> $GITHUB_ENV - name: Create Initial Comment + if: env.APP_EXISTS == 'true' uses: actions/github-script@v7 id: create-comment with: @@ -188,6 +144,7 @@ jobs: core.setOutput('comment-id', result.data.id); - name: Set Deployment URLs + if: env.APP_EXISTS == 'true' id: set-urls uses: actions/github-script@v7 with: @@ -219,6 +176,7 @@ jobs: ); - name: Initialize GitHub Deployment + if: env.APP_EXISTS == 'true' uses: actions/github-script@v7 id: init-deployment with: @@ -248,6 +206,7 @@ jobs: return deployment.data.id; - name: Update Status - Building + if: env.APP_EXISTS == 'true' uses: actions/github-script@v7 with: script: | @@ -267,6 +226,7 @@ jobs: }); - name: Build Docker Image + if: env.APP_EXISTS == 'true' id: build uses: ./.github/actions/build-docker-image with: @@ -276,6 +236,7 @@ jobs: PR_NUMBER: ${{ env.PR_NUMBER }} - name: Update Status - Deploying + if: env.APP_EXISTS == 'true' uses: actions/github-script@v7 with: script: | @@ -297,13 +258,16 @@ jobs: }); - name: Deploy to Control Plane + if: env.APP_EXISTS == 'true' run: cpflow deploy-image -a ${{ env.APP_NAME }} --run-release-phase --org ${{ vars.CPLN_ORG_STAGING }} --verbose - name: Retrieve App URL + if: env.APP_EXISTS == 'true' id: workload run: echo "WORKLOAD_URL=$(cpln workload get rails --gvc ${{ env.APP_NAME }} | tee | grep -oP 'https://[^[:space:]]*\.cpln\.app(?=\s|$)' | head -n1)" >> "$GITHUB_OUTPUT" - name: Update Status - Deployment Complete + if: env.APP_EXISTS == 'true' uses: actions/github-script@v7 with: script: | diff --git a/client/app/bundles/comments/components/Footer/Footer.jsx b/client/app/bundles/comments/components/Footer/Footer.jsx index 61c66df8..94e98162 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 + Rails On Maui on Twitter