Skip to content

Commit

Permalink
Merge pull request #5 from OWASP-BLT/bot-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieBLT authored Jun 3, 2024
2 parents 48dccb6 + a26e2b8 commit ccb723e
Show file tree
Hide file tree
Showing 13 changed files with 147 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI/CD
on:
- merge_group
- pull_request
- push
- workflow_dispatch

env:
FORCE_COLOR: 1

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- name: Check out Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run pre-commit
uses: pre-commit/[email protected]
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
local_settings.py
__pycache__
.env
.ruff_cache
.secrets
.venv
*.code-workspace
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-yaml
- id: fix-encoding-pragma
args:
- --remove
- id: mixed-line-ending
args:
- --fix=lf

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
exclude: ^(docs)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
2 changes: 2 additions & 0 deletions .secrets.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SLACK_APP_TOKEN=xapp-token
SLACK_BOT_TOKEN=xoxb-token
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# BLT-Sammich

The Slack bot for BLT

## Development

`poetry install`

`poetry run slack-machine`
25 changes: 25 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
display_information:
name: Sammich Dev
features:
bot_user:
display_name: Sammich Dev
always_online: false
slash_commands:
- command: /demo
description: Show demo output
should_escape: false
oauth_config:
scopes:
bot:
- channels:read
- commands
- groups:read
- im:read
- mpim:read
- users:read
settings:
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
34 changes: 31 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ description = ""
authors = ["Sarthak5598 <[email protected]>"]
readme = "README.md"

packages = [{ include = "sammich", from = "src" }]

[tool.poetry.dependencies]
python = "^3.10"
slack-machine = "^0.37.0"
python-dotenv = "^1.0.1"
gitpython = "^3.1.43"
slack-sdk = "^3.27.2"
slackeventsapi = "^3.0.1"
holidays = "^0.49"


[build-system]
Expand Down
Empty file added src/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions src/local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from dotenv import dotenv_values

secrets = dotenv_values(".secrets")

SLACK_APP_TOKEN = secrets["SLACK_APP_TOKEN"]
SLACK_BOT_TOKEN = secrets["SLACK_BOT_TOKEN"]

PLUGINS = ("sammich.plugins.demo.DemoPlugin",)
Empty file added src/sammich/__init__.py
Empty file.
Empty file added src/sammich/plugins/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions src/sammich/plugins/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from machine.plugins.base import MachineBasePlugin
from machine.plugins.decorators import command


class DemoPlugin(MachineBasePlugin):
"""Demo plugin"""

@command("/demo")
async def demo(self, command):
await command.say("This is a demo response!")

0 comments on commit ccb723e

Please sign in to comment.