Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7714a7fd3e
|
||
|
|
a34ff04776
|
||
|
|
c6ca9063a3
|
@@ -25,7 +25,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "Creating version"
|
echo "Creating version"
|
||||||
|
|
||||||
VERSION="0.0.4"
|
VERSION="0.0.2"
|
||||||
PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10)
|
PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10)
|
||||||
BRANCH_REF="${{ gitea.ref }}"
|
BRANCH_REF="${{ gitea.ref }}"
|
||||||
BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3)
|
BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3)
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ jobs:
|
|||||||
go-version: '1.25.4'
|
go-version: '1.25.4'
|
||||||
- name: Configure Git for SSH
|
- name: Configure Git for SSH
|
||||||
run: |
|
run: |
|
||||||
git config --global url."git@${{ secrets.GIT_HOST_ROOT }}:".insteadOf "https://${{ secrets.GIT_HOST_ROOT }}/"
|
git config --global url."git@git.kundeng.us:".insteadOf "https://git.kundeng.us/"
|
||||||
go env -w GOPRIVATE=${{ secrets.GIT_HOST_ROOT }}/phoenix/*
|
go env -w GOPRIVATE=git.kundeng.us/phoenix/*
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/swoosh_deploy_key
|
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/swoosh_deploy_key
|
||||||
chmod 600 ~/.ssh/swoosh_deploy_key
|
chmod 600 ~/.ssh/swoosh_deploy_key
|
||||||
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
|
ssh-keyscan ${{ vars.MY_HOST }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
eval $(ssh-agent -s)
|
eval $(ssh-agent -s)
|
||||||
ssh-add -v ~/.ssh/swoosh_deploy_key
|
ssh-add -v ~/.ssh/swoosh_deploy_key
|
||||||
|
|||||||
+3
-13
@@ -14,7 +14,6 @@ import (
|
|||||||
"git.kundeng.us/phoenix/swoosh/swoop/types"
|
"git.kundeng.us/phoenix/swoosh/swoop/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type MessageSender struct {
|
type MessageSender struct {
|
||||||
Config *config.TwiloConfig
|
Config *config.TwiloConfig
|
||||||
}
|
}
|
||||||
@@ -32,11 +31,12 @@ func (m *MessageSender) Send(msg message.Message, number contact.Contact, sendTi
|
|||||||
params := &twilioApi.CreateMessageParams{}
|
params := &twilioApi.CreateMessageParams{}
|
||||||
params.SetTo(number.PhoneNumber)
|
params.SetTo(number.PhoneNumber)
|
||||||
params.SetFrom(m.Config.Number)
|
params.SetFrom(m.Config.Number)
|
||||||
params.SetMessagingServiceSid(m.Config.ServiceSID)
|
|
||||||
params.SetBody(msg.Content)
|
params.SetBody(msg.Content)
|
||||||
if sendTime != nil && isSchedulable(now, sendTime) {
|
if sendTime != nil {
|
||||||
|
if sendTime.After(now) {
|
||||||
params.SetSendAt(*sendTime)
|
params.SetSendAt(*sendTime)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if resp, err := client.Api.CreateMessage(params); err != nil {
|
if resp, err := client.Api.CreateMessage(params); err != nil {
|
||||||
return nil, fmt.Errorf("Error sending message: %v", err)
|
return nil, fmt.Errorf("Error sending message: %v", err)
|
||||||
@@ -48,13 +48,3 @@ func (m *MessageSender) Send(msg message.Message, number contact.Contact, sendTi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isSchedulable(now *time.Time, scheduled *time.Time) (bool) {
|
|
||||||
early := now.Add(300 * time.Second)
|
|
||||||
|
|
||||||
if scheduled.Before(early) && scheduled.After(now) {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user