Skip to content

Commit

Permalink
Use GitHub Actions instead of Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloDalRi committed Oct 12, 2023
1 parent 5aaf193 commit bb8eccb
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 128 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/afternoon_seal.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: "Afternoon Seal"

on: workflow_dispatch
on:
schedule:
- cron: '00 12 * * 1-5' # Runs at 12:00, Monday through Friday.

env:
SEAL_ORGANISATION: alphagov
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

jobs:
afternoon-seal:
Expand All @@ -18,6 +24,8 @@ jobs:
id: afternoon_seal
run: |
teams=(
govuk-accounts
govuk-platform-security-reliability
)
for team in ${teams[*]} ; do
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/dependapanda.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: "Dependapanda"

on: workflow_dispatch
# schedule:
# - cron: '00 8 * * 1-5' # Runs at 8:00, Monday through Friday.

env:
SEAL_ORGANISATION: alphagov
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

jobs:
dependapanda:
Expand All @@ -16,13 +23,12 @@ jobs:

- name: Dependapanda
id: dependapanda
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
teams=(
)
for team in ${teams[*]}; do
./bin/seal_runner.rb $team dependapanda
sleep 60
done
teams=(
govuk-platform-security-reliability
)
for team in ${teams[*]}; do
./bin/seal_runner.rb $team dependapanda
sleep 60
done
36 changes: 21 additions & 15 deletions .github/workflows/morning_seal.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: "Morning Seal"

on: workflow_dispatch
# schedule:
# - cron: '30 7 * * 1-5' # Runs at 7:30, Monday through Friday.

env:
SEAL_ORGANISATION: alphagov
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

jobs:
morning-seal:
Expand All @@ -16,19 +23,18 @@ jobs:

- name: Morning Seal
id: morning_seal
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
teams=(
)
for team in ${teams[*]}; do
./bin/seal_runner.rb $team
done
morning_quote_teams=(
)
for team in ${morning_quote_teams[*]}; do
./bin/seal_runner.rb $team quotes
done
teams=(
govuk-platform-security-reliability
)
for team in ${teams[*]}; do
./bin/seal_runner.rb $team
done
morning_quote_teams=(
)
for team in ${morning_quote_teams[*]}; do
./bin/seal_runner.rb $team quotes
done
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

10 changes: 0 additions & 10 deletions bin/afternoon_seal.sh

This file was deleted.

24 changes: 0 additions & 24 deletions bin/dependapanda.sh

This file was deleted.

39 changes: 0 additions & 39 deletions bin/morning_seal.sh

This file was deleted.

6 changes: 3 additions & 3 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# # frozen_string_literal: true

require './server'
run SealApp
# require './server'
# run SealApp
2 changes: 1 addition & 1 deletion lib/slack_poster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def set_mood_from_team
end

def channel
@team_channel = "#bot-testing" if ENV["DYNO"].nil?
@team_channel = "#bot-testing" if ENV["DEVELOPMENT"]
end
end
50 changes: 25 additions & 25 deletions server.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
require "sinatra"
require "./lib/seal"
require "./lib/github_fetcher"
require "./lib/message_builder"
require "./lib/slack_poster"
require "./lib/team_builder"
# require "sinatra"
# require "./lib/seal"
# require "./lib/github_fetcher"
# require "./lib/message_builder"
# require "./lib/slack_poster"
# require "./lib/team_builder"

class SealApp < Sinatra::Base
get "/" do
"Hello Seal"
end
# class SealApp < Sinatra::Base
# get "/" do
# "Hello Seal"
# end

post "/bark/:team_name/:secret" do
if params[:secret] == ENV["SEAL_SECRET"]
team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
Seal.new(team).bark
"Seal received message with #{params[:team_name]} team name"
end
end
# post "/bark/:team_name/:secret" do
# if params[:secret] == ENV["SEAL_SECRET"]
# team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
# Seal.new(team).bark
# "Seal received message with #{params[:team_name]} team name"
# end
# end

post "/bark-quotes/:team_name/:secret" do
if params[:secret] == ENV["SEAL_SECRET"]
team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
Seal.new(team).bark(mode: "quotes")
"Seal received message with #{params[:team_name]} team name for quotes"
end
end
end
# post "/bark-quotes/:team_name/:secret" do
# if params[:secret] == ENV["SEAL_SECRET"]
# team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
# Seal.new(team).bark(mode: "quotes")
# "Seal received message with #{params[:team_name]} team name for quotes"
# end
# end
# end

0 comments on commit bb8eccb

Please sign in to comment.