Merge branch 'develop' into feat/context-menu-snooze

This commit is contained in:
Sivin Varghese
2024-02-23 09:28:34 +05:30
committed by GitHub
5 changed files with 37 additions and 25 deletions
+37
View File
@@ -0,0 +1,37 @@
## github action to check deployment success
## curl the deployment url and check for 200 status
## deployment url will be of the form chatwoot-pr-<pr_number>.herokuapp.com
name: Deploy Check
on:
pull_request:
jobs:
deployment_check:
name: Check Deployment
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install -y jq
- name: Print Deployment URL
run: echo "https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com"
- name: Check Deployment Status
run: |
max_attempts=10
attempt=1
status_code=0
while [ $attempt -le $max_attempts ]; do
response=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api)
status_code=$(echo "$response" | jq -r 'if .version and .timestamp and .queue_services and .data_services then 200 else 400 end')
if [ $status_code -eq 200 ]; then
echo "Deployment successful"
exit 0
else
echo "Deployment status unknown, retrying in 3 minutes..."
sleep 180
attempt=$((attempt + 1))
fi
done
echo "Deployment failed after $max_attempts attempts"
exit 1
fi
-5
View File
@@ -2,7 +2,6 @@ require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- ./lib/rubocop/user_find_by.rb
Layout/LineLength:
Max: 150
@@ -141,10 +140,6 @@ RSpec/MultipleExpectations:
RSpec/MultipleMemoizedHelpers:
Max: 14
# custom rules
UseFromEmail:
Enabled: true
AllCops:
NewCops: enable
Exclude:
-2
View File
@@ -168,9 +168,7 @@ class Contact < ApplicationRecord
end
def self.from_email(email)
# rubocop:disable UseFromEmail,Migration/DepartmentName
find_by(email: email.downcase)
# rubocop:enable UseFromEmail,Migration/DepartmentName
end
private
-2
View File
@@ -157,9 +157,7 @@ class User < ApplicationRecord
end
def self.from_email(email)
# rubocop:disable UseFromEmail,Migration/DepartmentName
find_by(email: email.downcase)
# rubocop:enable UseFromEmail,Migration/DepartmentName
end
private
-16
View File
@@ -1,16 +0,0 @@
require 'rubocop'
# Enforces use of from_email for email attribute lookups
class UseFromEmail < RuboCop::Cop::Cop
MSG = 'Use `from_email` for email lookups to ensure case insensitivity.'.freeze
def_node_matcher :find_by_email?, <<~PATTERN
(send _ :find_by (hash (pair (sym :email) _)))
PATTERN
def on_send(node)
return unless find_by_email?(node)
add_offense(node, message: MSG)
end
end